On Sun, May 31, 2015 at 10:51 AM, Jonathan S. Shapiro <[email protected]> wrote: > How about this: > > Pick a language of your choice. Show me how to declare the type of an AST > node that satisfies the following properties: > > 1. The grammar is the expression grammar for four-function expression > arithmetic plus negation plus assugnment. Note that negation is unary and > assignment is NOT an expression. You don't have to worry about the parsing > or precedence or the like. You only need to create a suitable AST. > 2. Every AST node has a field of type "Location". This will serve as the > non-variant part. > 3. The structural correctness of the tree should be statically checked to > the degree that this can be expressed. > 4. It should be possible to write a single procedure taking an argument of > type ASTNode and performing some form of recursive-descent pass on that node > type.
So how's this OCaml?
AST.ml
Description: Binary data
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
