How to create a pure, synchronous and serializable parser? #1326
-
Hi team. I wanna export my DSL parser as a tiny core lib for other my applications. But I am not sure what are the minimal steps. Firstly I did it like this:
It worked. But later I faced problem when I wanna serialize the parsed AST with After that I followed
Serialization succeeds now. The only flaw is Any suggestions from you? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hey @jindong-zhannng, If you just need an AST (without cross reference resolution, diagnostics, etc.), you can just invoke the parser: const parseResult = services.parser.Parser.parse(program); The parser is sync. Note that in order to resolve cross references, the async |
Beta Was this translation helpful? Give feedback.
Hey @jindong-zhannng,
If you just need an AST (without cross reference resolution, diagnostics, etc.), you can just invoke the parser:
The parser is sync. Note that in order to resolve cross references, the async
DocumentBuilder
API needs to be used.