Skip to content

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

Description

@dasblinkenlight

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions