Quantcast

Add OvaleAST module to generate an abstract syntax tree from a script.

Author Johnny C. Lam <jlam88@gmail.com>
Author date 2014-07-13 11:31:23
Author local date 2014-07-13 11:31:23 +0000
Committer Johnny C. Lam <jlam88@gmail.com>
Committer date 2014-07-13 11:31:23
Committer local date 2014-07-13 11:31:23 +0000
Commit c49f451a2d1581fccb2ce50bff1aee57576489d5
Tree 4cf866f6c5d830628b5398e3e6b396e74fe51127
Parent 37498a04076cdb63db8276a0db18da5ea23aca6d
Add OvaleAST module to generate an abstract syntax tree from a script.

This module implements a recursive descent parser for the Ovale script
language and generates an AST for further manipulation.

There are some ambiguities in the script language:

    * Unary negation versus binary subtraction.
    * '{' and '}' can enclose either a statement group or an expression.

The public methods for OvaleAST are:

    ParseCode(code) to generate an AST from a block of code.
    ParseScript(name) to generate an AST from a named script.
    Unparse(node) to generate a block of code from an AST node.
    Optimize(ast) to make optimization passes through the AST.

Unparse(ParseCode(Code)) should be roughly idempotent in that the original
code and the resulting code should have the same AST representation.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1542 d5049fe3-3747-40f7-a4b5-f36d6801af5f