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

Hydra-Go #65

Open
joshsh opened this issue Mar 16, 2023 · 6 comments
Open

Hydra-Go #65

joshsh opened this issue Mar 16, 2023 · 6 comments
Assignees

Comments

@joshsh
Copy link
Collaborator

joshsh commented Mar 16, 2023

A partial or even full Go implementation of Hydra is likely to be required for some of our work at LinkedIn. Start by creating a Go model and Go language constraints, then proceed to a type-level Go coder. Extend this to a bicoder if practical, and implement as much of the Hydra kernel as is required for that particular use case. The recent work on migrating the kernel to Java will likely make a Go migration simpler.

@joshsh joshsh changed the title hydra-go Hydra-Go Mar 18, 2023
@joshsh joshsh mentioned this issue Mar 18, 2023
@aman-dureja aman-dureja self-assigned this Apr 20, 2023
@aman-dureja
Copy link
Collaborator

Started working on this, on the branch feature-65-go.

@aman-dureja
Copy link
Collaborator

TODO: figure out how to represent the following productions:

newline        = /* the Unicode code point U+000A */ .
unicode_char   = /* an arbitrary Unicode code point except newline */ .
unicode_letter = /* a Unicode code point categorized as "Letter" */ .
unicode_digit  = /* a Unicode code point categorized as "Number, decimal digit" */ .

@aman-dureja
Copy link
Collaborator

TODO: figure out how to represent keywords:

break        default      func         interface    select
case         defer        go           map          struct
chan         else         goto         package      switch
const        fallthrough  if           range        type
continue     for          import       return       var

@joshsh
Copy link
Collaborator Author

joshsh commented Apr 21, 2023

TODO: figure out how to represent the following productions:

newline        = /* the Unicode code point U+000A */ .
unicode_char   = /* an arbitrary Unicode code point except newline */ .
unicode_letter = /* a Unicode code point categorized as "Letter" */ .
unicode_digit  = /* a Unicode code point categorized as "Number, decimal digit" */ .

These lexer details are really only important if you intend to use the grammar to generate a parser and/or a serializer for Go. That is the intention of preserving all of the information in the BNF grammar, but so far we haven't tried to generate serializers (e.g. see GraphQL). That would definitely be a worthwhile thing to do for the first time (and would probably require some extension of the hydra/grammar module).

@joshsh
Copy link
Collaborator Author

joshsh commented Apr 21, 2023

TODO: figure out how to represent keywords:

break        default      func         interface    select
case         defer        go           map          struct
chan         else         goto         package      switch
const        fallthrough  if           range        type
continue     for          import       return       var

See Hydra.Langs.Java.Language and Hydra.Langs.Java.Utils (sanitizeJavaName) for an example of how to escape names so as to avoid conflicts with keywords.

@aman-dureja
Copy link
Collaborator

Leaving this comment as a reminder to myself: I need to set up the simplest possible test case to quickly validate that I'm doing things correctly. I think a good simple case would be to generate a simple integer variable declaration in Go, from a Hydra DSL.

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

No branches or pull requests

2 participants