Closed furesoft closed 3 years ago
There's no built-in way of creating an AST with Eto.Parse right now, but you can do this relatively easily using the visitor pattern on matches. This is done for things like the EbnfGrammar, which turns a grammar parsed using Eto.Parse into the Parser objects (the AST).
I've been thinking of a way to map matches to an AST more automatically, however doing it manually is certainly the most flexible (and not too painful) way as your grammar won't have to match the AST exactly.
as for me, My ultimate goal is not to build AST, but to build objects of my domain model. To do that, I need to navigate existing structure. It would be convinient for me to navigate with XPath-like API (because it is well documented standart).
see https://github.com/picoe/Eto.Parse/issues/27 and https://github.com/picoe/Eto.Parse/issues/28
Now done with #58! 🎉
Not really documented, but hopefully the samples help. There's a json > tokens sample, and a json >.concrete object sample. More samples could be made as questions arise.
how can i build a abstract syntax tree with eto.parse?