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

Add basic project skeleton, with trivial interpreter in place #1

Merged
merged 1 commit into from Jan 26, 2020

Conversation

perlun
Copy link
Collaborator

@perlun perlun commented Jan 26, 2020

This is pretty much a straight copy of perlun/cslox@64da4fd, with the following adjustments made:

  • Rename the namespaces to Perlang.*

  • Split the project into three parts: Perlang.Common, Perlang.Interpreter and Perlang.Parser. The idea here is to think already at an early stage about making the scanning and parsing parts reusable from non-interpreting/compiling scenarios. For example, to built a VS Code language server; it makes a lot of sense to not force all use cases that want to inspect Perlang source code to reimplement the whole language parser over and over again.

  • Fix the code generated by scripts/generate_ast_classes.rb feel a bit more natural in the C# world, by using properties instead of plain fields. Also fixed the visibility since the generated code will now be in a different namespace from the classes that consume it.

  • Try to improve the error handling slightly. It's still far from perfect and this is probably one of the things that will be improved
    on in the quite near future. Ideally, ParseStatements() and ParseExpression() would return not just the parsed statements/expression, but in case something goes wrong, the full list of parse errors should be available there. Nothing should be printed to stdout unless the consumer decides to print it.

  • Extract a few interfaces like IInterpreter, IParseErrorHandler etc. We are not using any IOC container yet and time will tell if this will be necessary or not.

This is pretty much a straight copy of
perlun/cslox@64da4fd,
with the following adjustments made:

- Rename the namespaces to Perlang.*

- Split the project into three parts: Perlang.Common,
  Perlang.Interpreter and Perlang.Parser. The idea here is to think
  already at an early stage about making the scanning and parsing parts
  reusable from non-interpreting/compiling scenarios. For example, to
  built a VS Code language server; it makes a lot of sense to not force
  all use cases that want to inspect Perlang source code to reimplement
  the whole language parser over and over again.

- Fix the code generated by scripts/generate_ast_classes.rb feel a bit
  more natural in the C# world, by using properties instead of plain
  fields. Also fixed the visibility since the generated code will now be
  in a different namespace from the classes that consume it.

- Try to improve the error handling slightly. It's still far from
  perfect and this is probably one of the things that will be improved
  on in the quite near future. Ideally, ParseStatements() and
  ParseExpression() would return not just the parsed
  statements/expression, but in case something goes wrong, the full list
  of parse errors should be available there. Nothing should be printed
  to stdout unless the consumer decides to print it.

- Extract a few interfaces like IInterpreter, IParseErrorHandler etc. We
  are not using any IOC container yet and time will tell if this will be
  necessary or not.
@perlun perlun merged commit 3de39a3 into master Jan 26, 2020
@perlun perlun deleted the feature/add-initial-project-skeleton branch January 26, 2020 21:34
@perlun perlun added the enhancement New feature or request label Feb 18, 2022
@perlun perlun added this to the 0.1.0 milestone Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant