Last active
September 22, 2018 01:05
-
-
Save tyler569/233522b2a929fe2af21d68f9eef50a69 to your computer and use it in GitHub Desktop.
Revisions
-
tyler569 revised this gist
Sep 22, 2018 . 1 changed file with 23 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ tyler@xps:~/lcc$ python3 parse_test.py > > > > 2 - (2 - 2) [2, '-', '(', 2, '-', 2, ')'] ('-', 2, ('-', 2, 2)) 2 > > (2 - 2) - 2 ['(', 2, '-', 2, ')', '-', 2] ('-', ('-', 2, 2), 2) -2 > > (1 + 1) * 2 ['(', 1, '+', 1, ')', '*', 2] ('*', ('+', 1, 1), 2) 4 > 1 + (1 * 2) [1, '+', '(', 1, '*', 2, ')'] ('+', 1, ('*', 1, 2)) 3 > -
tyler569 created this gist
Sep 22, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ tyler@xps:~/lcc$ python3 parse_test.py > > 2+2 [2, '+', 2] ('+', 2, 2) 4 > 2*2+2 [2, '*', 2, '+', 2] ('+', ('*', 2, 2), 2) 6 > 2+2*2 [2, '+', 2, '*', 2] ('+', 2, ('*', 2, 2)) 6 > 2-2-2 [2, '-', 2, '-', 2] ('-', ('-', 2, 2), 2) -2 > 4/2-1 [4, '/', 2, '-', 1] ('-', ('/', 4, 2), 1) 1.0 > 1-4/2 [1, '-', 4, '/', 2] ('-', 1, ('/', 4, 2)) -1.0 > 2*2+3*4/5-3-4 [2, '*', 2, '+', 3, '*', 4, '/', 5, '-', 3, '-', 4] ('-', ('-', ('+', ('*', 2, 2), ('*', 3, ('/', 4, 5))), 3), 4) -0.5999999999999996 >