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

Feature request: let end-users plug in their own backend code generators written in a template language (ST4) #804

Open
dasblinkenlight opened this issue Dec 3, 2024 · 0 comments

Comments

@dasblinkenlight
Copy link

Problem:
Current implementation of the P compiler relies on backend code generators hand-written in C#, making it hard for end-users to write their own code generators. It also makes current code generators harder to write and maintain.

Solution:
String Template 4 (ST4) offers a simple way of building user-defined code generators. Integrating with ST4 is a straightforward task with very clear "handoff" between the host program and the template engine. The host program needs to read the templates, make some version of a preprocessed program tree available to them, and invoke the templates.

Notes:

  • Making this pluggable will likely require adding some sort of a config file that links template names to the names of output files.
  • There are multiple ports of ST4 to C#, such as this one.
  • My fork of the C# port of ST4 adds back the use of embedded resources as templates, which may be helpful in re-defining some of the existing backend generators in ST4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant