10 lines
241 B
Python
10 lines
241 B
Python
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)
|