CST with Ambiguity nodes

19 views
Skip to first unread message

mayb...@googlemail.com

unread,
Apr 4, 2017, 10:23:57 AM4/4/17
to antlr-discussion
Hi,

I am currently investigating how much effort it would be to create a CST covering all ambiguities with ANTLR.
I really need to cover ambiguities as I am working with syntax-safe template languages, just in case as there is somebody who want to investigate whether I really need to cover ambiguities in my grammar or my grammar is just crap :)

Currently, there I adapted ANTLR 4.5.1 in the sense that I am able to create a CST forest, whereas every CST covers one valid alternative parse tree of the current file. Besides the overhead of the ambiguities itself it even includes the overhead of parsing the file from the beginning again and again. So to optimize this process a little bit, I would like to integrate artifical ambiguity nodes whenever there are more than one exact alternatives detected. The ambiguity node than should have all possible parse trees as children.
After reading 1-2 hours the source code I am not totally convinced that this can be done in a day of work.

But I would like to hear an expert's opinion as well :)
The target would be something like SDF provides http://www.metaborg.org/en/latest/source/langdev/meta/lang/sdf3.html?highlight=ambiguity#preferences

Best Regards,
Malte
Reply all
Reply to author
Forward
0 new messages