initial (hacky af)
This commit is contained in:
9
examples/calc.py
Normal file
9
examples/calc.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import gll
|
||||
|
||||
ws = gll.skipmany(gll.whitespace(), tag="spaces")
|
||||
num = gll.many1(gll.digit(), tag="number")
|
||||
op = gll.string("+", tag="op") | gll.string("-", tag="op")
|
||||
|
||||
expr = gll.seq(num, ws, op, ws, num, tag="expr")
|
||||
|
||||
parser = gll.many(expr)
|
Reference in New Issue
Block a user