34 Commits

Author SHA1 Message Date
Josh Holtrop
49a061da2f remove debug grep to show translated C source with line numbers 2011-08-31 10:28:24 -04:00
Josh Holtrop
a2050cd5a0 fix a couple PLY lexer warnings 2011-08-31 10:27:36 -04:00
Josh Holtrop
6ac296e1d4 do not use yacc.yacc() outputdir option as this causes tables to always be regenerated 2011-08-31 10:26:31 -04:00
Josh Holtrop
68f6b3fc08 allow -o with -E 2011-08-30 16:38:17 -04:00
Josh Holtrop
1609cf5911 implement -E command-line switch 2011-08-30 16:34:51 -04:00
Josh Holtrop
0ddfabc64b name build() method translate() for clarity 2011-08-30 16:30:15 -04:00
Josh Holtrop
59a9380566 pass AST to Compiler() constructor 2011-08-30 16:29:26 -04:00
Josh Holtrop
4ae55322bb propagate return code from C compiler 2011-08-30 16:22:47 -04:00
Josh Holtrop
94677bc79e report line and column number on parsing error 2011-08-30 16:20:38 -04:00
Josh Holtrop
58d3cfd804 run-tests reacts to compiler exit code 2011-08-30 16:14:00 -04:00
Josh Holtrop
0417799276 change return code based on success 2011-08-30 16:12:10 -04:00
Josh Holtrop
05758a1557 improve error handling 2011-08-30 16:10:13 -04:00
Josh Holtrop
6248dc554d return build status from build() 2011-08-30 16:07:45 -04:00
Josh Holtrop
1d44cc0e6e parser returns None if an error is seen 2011-08-30 16:07:27 -04:00
Josh Holtrop
9fe95aa7f2 convert lexer and parser into classes 2011-08-30 16:03:13 -04:00
Josh Holtrop
002aa69d03 add tests folder and run-tests script 2011-08-30 15:07:08 -04:00
Josh Holtrop
f534f3e753 properly lex a string with escaped characters 2011-08-30 13:59:15 -04:00
Josh Holtrop
13fbaea4d1 traverse AST and dump CExpr nodes 2011-08-30 13:36:35 -04:00
Josh Holtrop
854b82e088 add Node.visit() method 2011-08-30 13:35:51 -04:00
Josh Holtrop
ba80f5d9f7 fix string to not include doublequotes in value 2011-08-30 13:35:39 -04:00
Josh Holtrop
905448378e call gcc to compile and link jtlc-written C sources 2011-08-30 13:05:59 -04:00
Josh Holtrop
581be4f10d add "unit" top-level parsing target 2011-08-30 12:02:52 -04:00
Josh Holtrop
b8e617bd39 change Node to nodes module; use a class hierarchy for node types 2011-08-30 10:58:36 -04:00
Josh Holtrop
0b33cc7401 break out c_expr into statement/expression 2011-08-30 10:43:58 -04:00
Josh Holtrop
0a816d9636 parse functions return a Node instance 2011-08-30 10:40:22 -04:00
Josh Holtrop
6f64f6d6d9 add Node class 2011-08-30 10:39:52 -04:00
Josh Holtrop
1c20826e62 add a simple C-expression grammar rule 2011-08-29 16:47:56 -04:00
Josh Holtrop
1d612cd543 ignore parser.out 2011-08-29 16:47:39 -04:00
Josh Holtrop
c3b5db9f6e ignore parsetab.py 2011-08-29 16:36:34 -04:00
Josh Holtrop
dd4b51a272 write parsetab to parser directory 2011-08-29 16:36:20 -04:00
Josh Holtrop
39389c03d3 add empty parserules module, add parser.parse() method 2011-08-29 16:23:29 -04:00
Josh Holtrop
71f4b01c23 mv lexer.py -> lexrules.py, remove get_lexer() and ply import 2011-08-29 14:37:36 -04:00
Josh Holtrop
bcb1e6a6ff add skeleton application 2011-08-29 11:24:44 -04:00
Josh Holtrop
2b4de69ff8 add lexer skeleton 2011-08-29 10:01:23 -04:00