Punkt (pronounced pυηkt) means dot, point or period in German.
Token type | REGEX |
---|---|
keyword | alloc bool char const dealloc else false float for function if int main print println rat return sizeof string true var void while |
identifier | [ _ a-z A-Z ] [ _ a-z A-Z 0-9 ]* |
booleanLiteral | true false |
characterLiteral | ' ASCII character ' |
integerLiteral | [ 0-9 ]+ |
floatLiteral | [ 0-9 ]* . [ 0-9 ]+ ((e | E ) (+ | - )? [ 0-9 ]+)? |
stringLiteral | " [ ^ " \n ]*" |
Arithmetic operators | + - * / |
Other operators | = % // ! && || sizeof alloc [] |
Comparison operators | == != > >= < <= |
Punctuators | { } ( ) . , < > -> |
This is a description of Punkt grammar, simplified slightly for better readability. The grammar that the Punkt parser actually implements is entirely unambiguous.
- Comments start with
#
and continue until either the next#
or the end of the line. - Maximum identifier length is 32 characters.
- Non-void functions with no return statement cause a runtime error.
- Declaration statements that are part of a for-loop should not end with a terminator (
.
).