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 feature to export NFA/DFA table as state diagram #20

Open
SicroAtGit opened this issue Oct 30, 2021 · 1 comment
Open

Add feature to export NFA/DFA table as state diagram #20

SicroAtGit opened this issue Oct 30, 2021 · 1 comment
Assignees
Labels
feature New feature

Comments

@SicroAtGit
Copy link
Owner

SicroAtGit commented Oct 30, 2021

For this feature the tool Graphviz will be used and should replace these codes:

For example, the regex engine creates the following dot code for the regex (a|b):

digraph nfa_state_diagram {

	rankdir = LR;
	size = "8,5";
	node [shape = circle];
	"" [shape = none, fixedsize = true, height = 0, width = 0];

	"" -> 1;

	1 -> 2 [label = "ε", style = dashed];

	2 -> 3 [label = "61"];

	3 -> 4 [label = "00"];

	4 -> 5 [label = "ε", style = dashed];

	5 [shape = doublecircle];

	1 -> 6 [label = "ε", style = dashed];

	6 -> 7 [label = "62"];

	7 -> 8 [label = "00"];
	
	8 -> 5 [label = "ε", style = dashed];
}

Graphviz then generates this NFA diagram visualization from the dot code:
nfa

@SicroAtGit SicroAtGit self-assigned this Oct 30, 2021
@SicroAtGit SicroAtGit added the feature New feature label Oct 30, 2021
@SicroAtGit SicroAtGit added this to the v1.0.0-beta milestone Oct 30, 2021
@SicroAtGit SicroAtGit removed this from the v1.0.0-beta milestone Dec 29, 2021
@tajmone
Copy link
Contributor

tajmone commented Dec 21, 2022

This feature is really cool, but I suggest that you pack it into an extra optional module instead of the native library, because the native PB compiler doesn't optimize for dead code, which means that the code for the graphs would be included in the generated binary file even in applications that don't actually use it.

GCC does remove dead code from the final binary, but since we don't know the internals of the PB-GCC backend we can't be sure of this without experimenting whether this optimization is actually enforced.

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

No branches or pull requests

2 participants