Generation of source code and executable code from formal descriptions
View Patent ↗A method of generating an executable that operates as a compiler includes: receiving a unified input description containing syntax rules for both regular and context-free expressions and interspersed code; generating a common internal representation from the unified input description; checking regular expressions in the common internal representation; checking context-free expressions in the common representation; checking the interspersed code; and outputting the executable.
1. A method comprising:
receiving at an input compiler scanning and parsing module of a computing device a unified input description containing syntax rules for both regular and context-free expressions and interspersed code;
generating with the computing device a common internal representation from the unified input description, wherein the common internal representation stores information on every attribute used in a grammar rule;
checking regular expressions in the common internal representation with a regular expression checker of the computing device;
checking context-free expressions in the common representation with context-free expression checker of the computing device;
checking the interspersed code, checking including checking the interspersed code and usage of the attributes for correctness or violations and violations are reported as error messages; and
outputting from a code generator of the computing device an executable, formed from the unified input description, the executable operating as a compiler.
2. The method of claim 1 , further comprising:
optimizing the common internal representation in the event that no error messages are present.
3. The method of claim 1 , further comprising:
generating a regular expression error message in the event that a regular expression error is detected; and
generating a context-free error message in the event that a context-free expression error is detected.