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

The next step of code generation #130

Open
chengluyu opened this issue Aug 24, 2022 · 0 comments
Open

The next step of code generation #130

chengluyu opened this issue Aug 24, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@chengluyu
Copy link
Member

This issue discusses the next code generation. There are several problems with the current code generator.

  1. The current AST is not standard and incomplete. As the MLscript’s syntax becomes more expressive. We should make use of most JavaScript syntax (excluding the bad parts, of course) in the generated code. The new syntax trees will be generated from Babel’s syntax tree definitions.
  2. Pretty printing must be throughly tested, as there is many trivial indentation and precedence errors in the generated code.
  3. Generate efficient and simple code. Now, we abuse IIFEs. For example, pattern matches and let expressions are translated into nested IIFEs, which are inefficient and unreadable.

After all, the goal is to make code generation more practical. I hope someday we can see a real world project making use of the code generator.

@chengluyu chengluyu added the enhancement New feature or request label Aug 24, 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

No branches or pull requests

1 participant