diff --git a/spf.lark b/spf.lark index abf8396..cc39036 100644 --- a/spf.lark +++ b/spf.lark @@ -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" diff --git a/spf.py b/spf.py index ecb0e34..6780ae8 100755 --- a/spf.py +++ b/spf.py @@ -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__":