Open
Description
✨ Feature request
Make the parser tree serializable with the \serialize()
function.
Motivation
Making the parser tree takes most of the total computation time.
If I could "cache" it somehow, it would be great !
Example
$tree = $parser->program();
print(\serialize($tree));
yields
Serialization of 'Antlr\Antlr4\Runtime\Comparison\Equivalence@anonymous' is not allowed
Alternatives
- Make the grammar more efficient (there's room, I'm a noob)
- Use a visitor to transpile to target language (but code gen is always tricky)
- Make my own AST from the parser tree, and somehow ensure it is serializable (contexts?)
- How do YOU do it ?
Additional context
The vt
time is the visitor. The rest could be cached, perhaps.
On more complex scripts, with nested flow statements, it goes up to seconds.
Cyprak
is the name of our budding DSL for an online role playing game (and is a pun onsprak
==language
)