start: (instruction)* instruction: keyword expression TERMINAL | type declaration TERMINAL | assignation TERMINAL | test | loop declaration: VARIABLE (EQUAL_SIGN expression)? assignation: VARIABLE EQUAL_SIGN expression expression: literal | list | range //| expression operator expression //| operator expression type: "booléen" | "entier" | "texte" | "liste" literal: ENTIER | BOOLEEN | texte texte: "\"" STRING "\"" list: "[" expression? ("," expression)* "]" range: "[" ENTIER? ":" ENTIER? "]" controls: test | loop operator: PLUS_SIGN | MINUS_SIGN | TIMES_SIGN | DIVIDE_SIGN // TODO: not complete PLUS_SIGN: "+" MINUS_SIGN: "-" TIMES_SIGN: "*" DIVIDE_SIGN: "/" EQUAL_SIGN: "=" test: "si" expression "alors" "{" instruction* "}" | "si" expression "alors" "{" instruction* "}" "sinon" "{" instruction* "}" loop: WHILES_KW expression WHILEE_KW "{" (instruction)* "}" TERMINAL: ";" VAR_CHARS: /[a-zA-Zçâêîôûéàèìòùëïü_]/ VARIABLE: VAR_CHARS (VAR_CHARS | /[0-9]/)* ADD_KW: "ajouter" SHOW_KW: "afficher" WHILES_KW: "tant que" WHILEE_KW: "faire" keyword: ADD_KW | SHOW_KW %import common.INT -> ENTIER TRUE_KW: "vrai" FALSE_KW: "faux" BOOLEEN: TRUE_KW | FALSE_KW %import common.ESCAPED_STRING -> STRING COMMENT: /#[^\n]*/ %ignore COMMENT %import common.WS %ignore WS