How does the Serializer work? Reg. NFA + NodeModel [message #900685] |
Wed, 08 August 2012 07:40 |
Stefan Kuhn Messages: 8 Registered: July 2009 |
Junior Member |
|
|
I've got several questions about the Serializer and I'm hoping someone could give me some notes about it.
1) How does the Serializer (Semantic Sequencer) work?
I know it uses backtracking and a nondeterministic finite automate (NFA) to generate a token stream from a model. It seems that the NFA is the driver, the generated MYDSL_MiniJavaSemanticSequencer is the table. How can it be ensured, that the parser tree build by the NFA for an EMF model is the same as the one created by the ANTLR parser for the token stream representing the same model?
It's basically the same question as: how is it ensured that the serialization of a parsed token stream is the same as the original token stream
SerializeModel(Parse(M)) ?= M | M : TokenStream[VisibleTokens]
2)
As far as I know, access to node model during 'unparsing'(creating a parse tree from an EMF model) is restricted to tree navigation and grammar rule access. How is inconsistency between semantic and node model handled? It seems to me that the NFA validates and virtually creates a node model. Virtually, because in case no INode exists, it's not created but the default is used for serialization. Where do I start, if I would like to explicitly add this INode?
3) What's the difference between 1.0 and 2.0 (between using serializer.SerializerFragment and parseTreeConstructor.ParseTreeConstructorFragment)
4)serializer.SerializerFragment {generateDebugData=true } prints the generates the constraints used to build the table.
Could you explain the generated xText file and graphiz DebugGraphs?
5) I've figured out that loading and -without change- saving triggers createSequence of an AbstractDelegatingSemanticSequencer.
So a trivial save like ...
ResourceSet inputResourceSet = new XtextResourceSet();// ResourceSetImpl();
Resource xTextResource = inputResourceSet.getResource(URI.createFileURI(RT_FAC_XTEXT_IN), true);
xTextResource.save(null);
... uses backtracking with a runtime of O(exp(n)) ?
6) It's stated in the 1.0 -> 2.0 migration guide that the node model no longer uses EObject. Is it somehow possible to obtain an EMF node (notation) model?
[Updated on: Wed, 08 August 2012 07:44] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02935 seconds