4 ms·
First off, thanks for taking the time to read and reply—I appreciate it. > take a look at what you've found about the program graph, and see what you could gen
by westoncb 10y ago
First off, thanks for taking the time to read and reply—I appreciate it.
> take a look at what you've found about the program graph, and see what you could generalize to _any_ graph of that kind.
This sounds interesting to me, but I may be missing something. I've taken a brief look at EMF and Ecore, and it sounds like Ecore has done this generalization you speak of.
The counterpart to this shows up in a somewhat odd way in my project: if I've been correct so far on the role of Ecore, the analog in my system would sort of be the definition of EBNF grammars (since grammars are analogs of metamodels and EBNF defines what valid grammars are).
This was a somewhat arbitrary choice on my part, and to be honest I haven't thought very much about what should constitute this meta-metamodel (i.e. the Ecore analog). What I do at the moment is parse EBNF grammars and use knowledge of their semantics to form a graph representing relationships between rules which refer to one another. The nice thing about this is I can take any existing EBNF grammar (in the ANTRL format), automatically parse it and get one of these graphs (because when I was originally doing this it was just to make a new kind of general purpose program editor; not new kinds of languages).
I believe this implies an answer to your question also:
> Can a graph such as those in your article describe self-containing constructs?
Yes. I have actually generated a graph for the Java language and wrote a little program that automatically walks around it, following the restrictions of these operators * , ?, and + to determine when it must follow an edge, or only optionally etc. —and since Java has nested classes, there's a kind of construction proof here.
Back to "see what you could generalize to _any_ graph of that kind." —thanks for the suggestion. This does seem like an interesting thing to consider, rather than borrowing my somewhat ad hoc carryover choice of parsed EBNF grammars ;)
> you could even be able to describe the structure of all such graphs (made of entities, atoms and edges with cardinalities) as a graph.
I have a suspicion that's somewhat on the lines of what I would do. My guess at the meta-metamodel is: any graph with edges having cardinalities, and optionally having associated ?, * , and + operators.
- westoncb 10y agoAlso, to clarify about the self-containing constructs: they just end up being cyclic sections in the graph. For instance, in Java we start with a node for classDeclaration, and the path to an inner class looks like classBody -> classBodyDeclaration -> memberDeclaration -> classDeclaration. (That's using this grammar for java: https://github.com/antlr/grammars-v4/blob/master/java/Java.g4 https://github.com/antlr/grammars-v4/blob/master/java/Java.g...)