Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-3088

FEEL Compiler: refactor to AST-based tree walk

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None
    • 2018 Week 42-44, 2018 Week 45-47
    • 8
    • NEW
    • NEW

      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

              evacchi Edoardo Vacchi (Inactive)
              evacchi Edoardo Vacchi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: