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

Add parseRawCF to use bnfc as library and parse LBNF from another application #484

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chaserhkj
Copy link
Contributor

This PR decouples the CF parsing process of LBNF file from unused back end options and checks, thus providing a new function parseRawCF that can be called from third party applications.

I wrote this mainly because I am building another project and wishes to use LBNF format as my project's input. I want to call BNFC parsing processes directly to parse LBNF in my application but found out that was impossible due to parseCF requiring SharedOptions. My project performs analysis and manipulation of the input grammar, rather than converting it to an output target format, thus will not use any part of the back end of BNFC.

Ideally we would want to separate ShareOptions to front end and back end options and just use front end options for parsing the raw CF. But for now it seems that the parsing process only uses lbnfFile option and so I separated this specific field and created the parseRawCF function.

Also, I will be implementing a few utilities to work on a parsed LBNF grammar in my project, most significant ones should be the formatter to print CF back to LBNF format, and the Chomsky normalization to convert any CF to Chomsky Normal Form. I am not sure if these are appropriate to be merged into BNFC as well, let me know you guys' thoughts on them, thank you!

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

Successfully merging this pull request may close these issues.

1 participant