some lines in lark

This commit is contained in:
Debucquoy Anthony 2025-03-16 11:16:19 +01:00
parent 6db9bb1f3f
commit c7f5075842
Signed by: tonitch
GPG Key ID: A78D6421F083D42E
2 changed files with 31 additions and 3 deletions

View File

@ -1 +1,29 @@
// Contient la gramaire de spf
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"

4
spf.py
View File

@ -20,10 +20,10 @@ def main():
args = parser.parse_args()
if args.dump:
print("Dump activated", file=sys.stderr)
print("Dump activated (TODO)", file=sys.stderr)
if args.trace:
print("Trace activated", file=sys.stderr)
print("Trace activated (TODO)", file=sys.stderr)
if __name__ == "__main__":