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

Pure C API for generating DFA #479

Open
whisper-bye opened this issue May 30, 2024 · 2 comments
Open

Pure C API for generating DFA #479

whisper-bye opened this issue May 30, 2024 · 2 comments

Comments

@whisper-bye
Copy link

Is there a C API that can be called directly to generate the data structures for the DFA? For example, take some regular expressions and generate a state transition diagram of a state machine

@skvadrik
Copy link
Owner

If you mean linking with re2c as a library, there's no API.

For state transition diagram you can use the DOT backend to generate a graph in .dot format (-D option).

There are also various debug options --dump-nfa, --dump-dfa-raw etc., see https://re2c.org/manual/manual_c.html#options. They only work if re2c was built in debug mode.

Finally, you may be able to generate some custom output using syntax files (they are primarily meant for adding new language backends). There is ongoing work on the syntax-files branch, see #450.

@whisper-bye
Copy link
Author

Thank you for your reply. I think this is a useful feature that allows generating a state machine without having to write RE files. When Manually writing the lexer, I can effortlessly obtain a minimized DFA to guide the process.

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

No branches or pull requests

2 participants