Visualization of Zig grammar
dundalek.com/grammkit/#./examples/zig.pegjsPosted Feb 21, 2021, 11:16 AM UTC
283
Posted Feb 21, 2021, 11:16 AM UTC
That looks very good. Does this also allow tracing the applied grammar rules/steps? That could be useful for coverage tracking in tests.
For measuring test coverage you would probably need something that customizes the compiler and inserts instrumentation points to the compiled output.
Since Zig provides grammar in BNF format, I was able to plug it into a grammar visualizer. The grammar can be explored by drilling around down to parse rules and also jumping to other parse rules that reference current one. I found it helpful to explore the corners of the language while learning Zig.