From lechner@cs.uml.edu Mon Mar 6 21:29:33 2006 From: Bob Lechner Subject: EERDs to define a language? Correction: STDs capture the [LL] grammar rules. To: sfrye@cs.uml.edu (Scott Frye) RJLRef: $PH/06s524/SWFChptr8Notes2.txt EERDs to define a language? Correction: (I forgot to add this in prior msg.) The ERD defines a repository RDB format, a parser's data structures, not its behavior. Nested state machines can capture the [LL] grammar rules for a context-free recursive descent parser. State actions need to be able to invoke other State Machines, even recursively. LCP can handle recursion. 2kf522 had a parser-generator project using LCP which was incomplete. See $PH/2kf522/LCPGuardConditions/2kf522LCPGC_wt_proj2k_Docs Here, parsing was only a sample application; the real goal was to add guard condition pointers to LCP's State Model database, so they could be separately compiled and executed like State Actions are. I believe a parser generator could be b ased on the BNF plus context-sensitive scoping rules, but there's no point since Lex/Yacc or Bison is a good parser generator (a specialized DSL in SWF terms). (YACC/Bison's LR parser generators define state machines - but they are too obfuscated by LR parsing semantics to be useful as human documentation.) OTOH, from a good C++ grammar with namescope recognition we could parse out more than gcc lets us see, like variable def/ref and function calltree associations, for use in tools that can visualize them and help debugging. [I expect that long before I could parse C++ (scoping rules being the hard part), Eclipse will have such tools, if it doesn't already . (Microsoft must have them now, in order to manage its WinXP and Office product families.) ] But it takes state actions to capture the context-sensitive non-BNF constraints and define the code generator's translated output. The EERDs define a repository that can hold multiple instances of a parse tree for one or many source code files. [Like bde, they need a FIle or FileSpec or FileVersion root entity to separate trees for distinct source code files. [But to capture all inter-file relationships they probably need a directory entity type above file level with multiple entries, like CVSROOT and make know about for BDE.] And it takes state actions to capture the context-sensitive non-BNF constraints and construct the objects in the code generator's parse tree and/or translated code output. ------------------------------------ > From sfrye@cs.uml.edu Thu Mar 2 08:40:28 2006 > Subject: Chapter 7.[8] >... > > What sparked my interest the most, so far, was the correlation of an > Abstract Syntax tree to a Metamodel. I never made the connection that the > entity relationship diagrams we had been using in your class > could be used to define a language. >