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

Output parsing tables in language-agnostic format (e.g. json) #39

Open
mewmew opened this issue Dec 10, 2016 · 12 comments
Open

Output parsing tables in language-agnostic format (e.g. json) #39

mewmew opened this issue Dec 10, 2016 · 12 comments

Comments

@mewmew
Copy link
Collaborator

mewmew commented Dec 10, 2016

Gocc has always been intended to support a variety of output language, as evident by the separation of Go related gen packages, from the generic aspects of the code.

This issue tracks the development of supporting Scala as an output language of Gocc, the requirements of which has been reported in llir/llvm#2 (comment)

cc: @reedkotler If you decided to investigate adding Scala support to Gocc, you may use this issue to discuss any issues you may run into, or any questions that may arise. @goccmack and @awalterschulze have good knowledge of the Gocc internals, so they should be able to help.

@mewmew
Copy link
Collaborator Author

mewmew commented Dec 10, 2016

@reedkotler Do you have an example Scala table that may be used as a reference for what the output should look like?

@reedkotler
Copy link

reedkotler commented Dec 10, 2016 via email

@reedkotler
Copy link

reedkotler commented Dec 10, 2016 via email

@awalterschulze
Copy link
Collaborator

Makes sense so you would want gocc to parse the bnf spec and generate the content of the tables.
But then instead of generated the tables as code in some target language, it should rather serialize the tables in a format which can be deserialized by a code generator. This code generator can then simply deserialize the table and generate the code. The generator would then typically be written in the same language as the target language. This way people maintaining the code generator can be experts in a single language.
Am I understanding you correctly?

@mewmew
Copy link
Collaborator Author

mewmew commented Dec 10, 2016

Actually this approach could also help alleviate the pain caused by huge tables, that #28 sought to address.

@awalterschulze
Copy link
Collaborator

awalterschulze commented Dec 10, 2016 via email

@reedkotler
Copy link

reedkotler commented Dec 10, 2016 via email

@awalterschulze
Copy link
Collaborator

I am for this feature, but I don't have time to build it. But I will try my best to support anyone who is up for making this. It sounds really cool and opens this project up to a greater community.

@awalterschulze
Copy link
Collaborator

The sdt rules can be a problem to translate. In my newest parsers I write with gocc, my ast is a protobuf message. This is a cross language serialization format, which means I only need one parser implementation. But thats not the point I want to make here. What protobuf also does, is it generates structures or classes or whatever is appropriate for that language, given the proto spec. This means that given a bnf and proto spec it is technically possible to generate consistent cross language parsers. And I don't think that is something I have seen before. This is just an idea and serialization of the tables is a nice step in that direction, if we ever want to do that.

@awalterschulze
Copy link
Collaborator

correction : if we ever want to create consistent cross language parsers

@mewmew
Copy link
Collaborator Author

mewmew commented Dec 11, 2016

I am for this feature, but I don't have time to build it. But I will try my best to support anyone who is up for making this. It sounds really cool and opens this project up to a greater community.

I'm also for investigating the benefits and drawbacks of serializing the tables in a language-agnostic format.

Anyone interested in this development may give it a go, and we can all discuss different approaches in this issue thread. Marking this issue with the "Help wanted" tag for now, so it is clear that anyone may step up and play around with it.

@mewmew mewmew changed the title Scala output language Output parsing tables in language-agnostic format (e.g. json) Dec 11, 2016
@mewmew
Copy link
Collaborator Author

mewmew commented Dec 11, 2016

Also updated the title of the issue to make it clear that this is not specifically about adding Scala support, but to change the output format of parsing tables from Go code (as generated today by Gocc), to a more language-agnostic format (e.g. json, protobuf, or other file format that makes sense). Which specific format to choose may be discussed in this issue thread.

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

No branches or pull requests

3 participants