Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pretty printer for legacy syntax #7

Closed
degory opened this issue Jul 13, 2017 · 0 comments
Closed

pretty printer for legacy syntax #7

degory opened this issue Jul 13, 2017 · 0 comments
Assignees

Comments

@degory
Copy link
Owner

degory commented Jul 13, 2017

When it comes to bootstrap the new compiler, I do not want to manually translate new compiler source from old L language syntax to new language - there could be tens of thousands of lines.

To avoid doing this, I can use the new compiler to translate new language syntax to old.

New syntax source -> [New compiler] -> Old syntax -> [Old compiler] -> Executable

Provided the new compiler is written in a subset of the new language where the new syntax maps directly onto the old syntax with the same semantics, this can be accomplished with a pretty printer.

Required:

  • Parser able to recognise a sufficiently large subset of the language to implement the new compiler in
  • Pretty printer able to accurately output the parse tree in equivalent old syntax
  • Pretty printer emits #file and #line directives so error reporting is accurate
  • Alter format of error output from old compiler in line with new, so same VS Code problem match regex will work across both sources of errors
  • Some kind of compiler driver to run the old compiler on the generated output, and merge error reports in with errors from new parser - shell scripts are probably sufficient

Nice to have:

  • Some mechanism to avoid changing timestamps on generated files if they're not changed - maybe via hashing of content.

Once this mechanism is in place, hand translate the new compiler to the new syntax, and all new development can be done in the new syntax.

@degory degory added this to the bootstrap milestone Jul 13, 2017
@degory degory self-assigned this Jul 13, 2017
@degory degory changed the title Target old language/old compiler target old language/old compiler Jul 14, 2017
@degory degory modified the milestones: self host on top of legacy compiler, bootstrap Jul 20, 2017
@degory degory changed the title target old language/old compiler pretty printer for legacy syntax Jul 20, 2017
degory added a commit that referenced this issue Jul 28, 2017
- Basic indentation
- Ghul syntax output
- L syntax output
#38 #7
@degory degory closed this as completed Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant