5 ms·
I came up with a pretty simple way of doing what I believe is the same thing that you're describing. The approach I take is to represent 'program models' as pat
by westoncb 10y ago
I came up with a pretty simple way of doing what I believe is the same thing that you're describing. The approach I take is to represent 'program models' as paths through the 'metamodel', which is a graph of 'program constructs'. So program models just end up being nested lists of numbered graph edges. http://westoncb.blogspot.com/2015/06/how-to-make-view-independent-program.html http://westoncb.blogspot.com/2015/06/how-to-make-view-indepe...
I haven't tried an implementation yet, but probably will at some point this year. Would be curious if you had any comments!
- asrp 10y agoI just read a good chunk of your article. Could you give an idea of what the graph and interface would look like if the language we want to write in is Lisp? It is indeed very string that we've settled on character based editors for making programs.
- lou1306 10y agoThat was an interesting read :) There are lots of similarities between what you describe and the Model-Driven approach I was talking about, except that the latter aims to be much more generic. Indeed, if you go ahead with the implementation, my suggestion is: take a look at what you've found about the program graph, and see what you could generalize to _any_ graph of that kind. And by the way, you could even be able to describe the structure of all such graphs (made of entities, atoms and edges with cardinalities) as a graph. If you want to check previous work in the Model-Driven field, look for: * Eclipse Modeling Framework (EMF); * Ecore, a language to describe metamodels; * OCL, a different language that can be used to add constraints to an EMF metamodel. While I was writing this, I came up with a question re:your graph structure. Java and Python allow for inner classes (ie. a class definition inside another class), and Python also allows for nested functions. Can a graph such as those in your article describe self-containing constructs?
- westoncb 10y agoI'm detained for now, but if you check back tomorrow I'll reply to this.
- westoncb 10y agoFirst 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...)