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

Allow non-string user tokens #43

Closed
zepalmer opened this issue Jun 12, 2013 · 1 comment
Closed

Allow non-string user tokens #43

zepalmer opened this issue Jun 12, 2013 · 1 comment

Comments

@zepalmer
Copy link

I would like to use the AST generated by BNFC throughout my language project. I see from the example of Java 1.1 that tokens which are not built into BNFC are always assumed to be strings. I would like to be able to parse a string like "123L" as a value 123 but I would like to be responsible for generating my own data value. I understand that this would make my tool backend-specific (although it's not hard to imagine writing one piece of code for each backend I want), but carrying an unparsed String value around everywhere that I'm using this AST type is far from ideal. Any thoughts?

Thanks! This tool is great; I hope I'll be able to use it.

@gdetrez
Copy link
Contributor

gdetrez commented Apr 20, 2015

This is old, I know.

If you really need to have customized data in the tree, one possible workaround is to change the generated code and to "save" your changes in a .diff patch that you could re-apply if you need to regenerate the code with bnfc.

I don't see a way to implement that in bnfc that without introducing language specific code in the grammar, which is a bit against the idea behind bnfc.

@gdetrez gdetrez closed this as completed Apr 20, 2015
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

2 participants