Sapan Bhatia | 64c7251 | 2017-06-23 02:32:45 -0700 | [diff] [blame] | 1 | from plyxproto.logicparser import * |
| 2 | import ply.lex as lex |
| 3 | import ply.yacc as yacc |
Sapan Bhatia | d70c378 | 2017-06-28 22:47:22 -0700 | [diff] [blame^] | 4 | import pdb |
Sapan Bhatia | 64c7251 | 2017-06-23 02:32:45 -0700 | [diff] [blame] | 5 | |
Sapan Bhatia | d70c378 | 2017-06-28 22:47:22 -0700 | [diff] [blame^] | 6 | test_1 = "<true>" |
| 7 | test_2 = "<a | b>" |
| 8 | test_3 = "<exists a: x=y>" |
| 9 | test_4 = "<forall a: exists b: x.b=y.b>" |
| 10 | test_5 = "<forall a: {{ a.endswith('good') }}>" |
Sapan Bhatia | 64c7251 | 2017-06-23 02:32:45 -0700 | [diff] [blame] | 11 | |
| 12 | DEBUG = 0 |
| 13 | |
Sapan Bhatia | d70c378 | 2017-06-28 22:47:22 -0700 | [diff] [blame^] | 14 | lexer = lex.lex(module=FOLLexer(), debug=DEBUG) |
Sapan Bhatia | 64c7251 | 2017-06-23 02:32:45 -0700 | [diff] [blame] | 15 | parser = yacc.yacc(module=FOLParser(), start='goal', debug=DEBUG) |
| 16 | |
| 17 | for x,v in globals().items(): |
| 18 | if x.startswith('test_'): |
| 19 | print parser.parse(v, lexer = lexer, debug=DEBUG) |