Open grosu opened 8 years ago
Looks nice! If we have a mechanism to produce AST from narrowing path (maude can already show the path), mod GRAMMAR
can be further simplified to have rules look like rl [A1] => a nil .
, but this module will be automatically generated by parsing mechanism anyway.
But this reminds me of how we used spoofax to create Java parser from SDF syntax, what is the technique there and how is narrowing approach going to beat them?
can be further simplified to have rules look like rl [A1] => a nil .
That's how it was initially, but I wanted to also see the AST. And the difference in performance is not that big. They are both equally slow.
But this reminds me of how we used spoofax to create Java parser from SDF syntax,
Why do you think there is any relationship here? SDF is specialized for parsing and that's what it does, it generates parsers from grammars, no narrowing, just a very specialized parser generator.
what is the technique there
Go ahead and read :) Both the SDF approach and our code to generate SDF from K and then parsers from SDF.
and how is narrowing approach going to beat them
Elegance and ease of implementation, provided to can bring the performance within bounds asymptotically similar.
In a meeting with Ben yesterday, it came out that we can use narrowing for parsing. This morning I did some experiments using Maude's narrowing support to flush out the idea, and it seems to work:
The above outputs:
Unfortunately, it looks like narrowing in Maude only works with full maude, and does not have support for associativity, so I had to cripple the definition to use
append
instead of associative lists. And in the end it is still slow. It takes about 1min for the above to terminate.So here is my question. We want a powerful narrowing engine for test-case generation and many other reasons anyway in the K framework, which should interact well with strategies and associative lists. Then why not use that for parsing as well? Of course, you will say "performance", but can't we improve the performance to an extent that it will not be a bottleneck? We want narrowing to be fast anyway.