[Grace-core] The interface to a dialect

Andrew P Black black at cs.pdx.edu
Wed Jan 27 09:11:48 PST 2016


I've added to minigrace the ability for a dialect to walk the processed-ast as well as the raw parse tree.  (The processed-ast contains the symbol table, declarations of variables implicitly declared in patterns,  requests on foo:= and []:= methods, and a few more things).

Right now, the dialect can get to the nodes in the module object's parse tree by declaring a method `checker`, and to the AST using method `astChecker`.  In addition, it can define atModuleStart and atModuleEnd.

I propose that we change this, to what is shown in the following sample:


def thisDialect is public = object {
    method parseChecker(moduleObj) { check(moduleObj) }
    method astChecker(moduleObj) { check(moduleObj) }
    method atStart { print "module start" }
    method atEnd { print "module end" }
}


That is, a module that wants to do checking should declare an object named "thisDialect" with some subset of the above four method.   Notice also that the two checker methods will be given the moduleNode object rather than the list of nodes in the body of the moduleNode.

Comments are invited before I make this change — particularly if you can think of a better way of doing this.

	Andrew


More information about the Grace-core mailing list