some lines in lark
This commit is contained in:
parent
6db9bb1f3f
commit
c7f5075842
30
spf.lark
30
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"
|
||||||
|
4
spf.py
4
spf.py
@ -20,10 +20,10 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.dump:
|
if args.dump:
|
||||||
print("Dump activated", file=sys.stderr)
|
print("Dump activated (TODO)", file=sys.stderr)
|
||||||
|
|
||||||
if args.trace:
|
if args.trace:
|
||||||
print("Trace activated", file=sys.stderr)
|
print("Trace activated (TODO)", file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user