blob: 7e7393fb2fba379294b3c4645643a8ebe77508ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/usr/bin/env python
import sys
import expression
def run (exp):
tokens = exp.split()
expparser = expression.ExpParser(tokens)
expparser.build()
expparser.dumpTree()
def main ():
run("6 + 34")
run("6 + 34 - 10")
run("6 + 34 - 10 + 200")
run("6 + 34 - 10 * 200")
run("6 + 34 - 10 * 200 + 18")
run("6 + 34 - 10 * 200 + 18 / 2")
run("6 * ( ( 10 + 2 ) - 10 ) * 33")
if __name__ == '__main__':
main()
|