c_to_python.git
5 years agoGet l_to_python working again, implement more necessary features such as sizeof
Nick Downing [Sun, 13 Jan 2019 11:27:41 +0000 (22:27 +1100)]
Get l_to_python working again, implement more necessary features such as sizeof

5 years agoTranslate expressions properly, with parentheses depending on precedence, translate...
Nick Downing [Sun, 13 Jan 2019 07:02:44 +0000 (18:02 +1100)]
Translate expressions properly, with parentheses depending on precedence, translate if/else, for, while, do/while, continue, break statements in emulated way

5 years agoTranslate declarations properly, initialized to an initializer expression, a type...
Nick Downing [Sun, 13 Jan 2019 00:36:21 +0000 (11:36 +1100)]
Translate declarations properly, initialized to an initializer expression, a type-appropriate zero expression if at top level, or None (temporarily disable translation of statements since we now output lines directly, rather than an AST)

5 years agoAdd type analysis system from ansi_c.py in regex.git with some slight updates
Nick Downing [Sat, 12 Jan 2019 23:04:51 +0000 (10:04 +1100)]
Add type analysis system from ansi_c.py in regex.git with some slight updates

5 years agoUse full grammar with %start translation_unit_opt, wrap action code in a dummy functi...
Nick Downing [Sat, 12 Jan 2019 13:01:09 +0000 (00:01 +1100)]
Use full grammar with %start translation_unit_opt, wrap action code in a dummy function to compensate, improve translation of functions and block statements

5 years agoReinstate the translation based on the new pilex/piyacc parser, tidy up a bit
Nick Downing [Sat, 12 Jan 2019 03:12:16 +0000 (14:12 +1100)]
Reinstate the translation based on the new pilex/piyacc parser, tidy up a bit

5 years agoChange to use pilex and piyacc with (?E{...}...) style AST generation rather than...
Nick Downing [Thu, 10 Jan 2019 22:11:31 +0000 (09:11 +1100)]
Change to use pilex and piyacc with (?E{...}...) style AST generation rather than the older style plex and pyacc, add a Makefile, remove a lot of useless cruft

6 years agoMinor adjustments, change xml_to_l.py to scan_to_l.py, make it fix token names
Nick Downing [Sun, 12 Aug 2018 02:14:30 +0000 (12:14 +1000)]
Minor adjustments, change xml_to_l.py to scan_to_l.py, make it fix token names

6 years agoTranslate more C constructs, categorize identifiers and add (self|yy). prefixes to... origin/master
Nick Downing [Sun, 12 Aug 2018 00:33:55 +0000 (10:33 +1000)]
Translate more C constructs, categorize identifiers and add (self|yy). prefixes to some of them, indent the containing flex source as well as the Python source

6 years agoImplement basic Python translation, mainly indenting/spacing, handle some expressions...
Nick Downing [Sun, 5 Aug 2018 12:01:12 +0000 (22:01 +1000)]
Implement basic Python translation, mainly indenting/spacing, handle some expressions and statements specially, in particular add logic for do/while loops etc

6 years agoMake it invoke the C preprocessor only once with all the actions, and correctly subst...
Nick Downing [Sun, 5 Aug 2018 01:57:56 +0000 (11:57 +1000)]
Make it invoke the C preprocessor only once with all the actions, and correctly substitute macros, deleting the preprocessed results of includes before parsing

6 years agoFirst cut at l_to_python.py translator which reads a lex specification (in XML format...
Nick Downing [Sun, 5 Aug 2018 00:59:05 +0000 (10:59 +1000)]
First cut at l_to_python.py translator which reads a lex specification (in XML format for now), and then passes each action through c_to_python.py to translate