[jboss-jira] [JBoss JIRA] (DROOLS-3088) FEEL Compiler: refactor to AST-based tree walk

Edoardo Vacchi (Jira) issues at jboss.org
Mon Oct 8 09:24:01 EDT 2018


Edoardo Vacchi created DROOLS-3088:
--------------------------------------

             Summary: FEEL Compiler: refactor to AST-based tree walk
                 Key: DROOLS-3088
                 URL: https://issues.jboss.org/browse/DROOLS-3088
             Project: Drools
          Issue Type: Task
            Reporter: Edoardo Vacchi
            Assignee: Edoardo Vacchi


Current implementation of the compiler walks the parse tree generated by ANTLR, which is a bit cumbersome because of the way the grammar has to be written to deal with priorities/ambiguities. Luckily, many of such issues are solved by the interpreter implementation, which walks the parse tree and generates a neat, simpler Abstract Syntax Tree. 

This tasks is to refactor our current compiler to walk that AST, instead of the larger parse tree.

Benefits:
- less "visit" cases in the visitor
- more opportunities to "optimize" the tree (e.g, tree rewrites, constant folding)
- more opportunities to refactor tree walking phases (e.g. we could add a "type-evaluation" phase)
- a chance to refactor code gen utilities to support classes, and simplify the code in general

- cons: it takes a bit of time, but the AST nodes are really a handful, so it should not take that much 



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list