compilation/spf.lark

30 lines
555 B
Plaintext

start: (instruction)* TERMINAL
instruction: KEYWORD TERMINAL
| declaration TERMINAL
declaration: TYPE NOM
| TYPE NOM "=" expression
expression: literal
| list
| range
| expression operator expression
| operator expression
controls: test
| loop
test: "si" expression "alors" "{" instruction* "}"
loop: "si" expression "alors" { (instruction)* }
COMMENT: "#" /[^\n]/
%ignore COMMENT
TERMINAL: ";"
VARIABLE: /([a-z]|[A-Z]|_)+[a-z]|[A-Z]|[0-9]_)+/ // TODO: ajouter accents
TYPE: "booléen" | "entier" | "texte" | "liste"