Class Compiler


  • public class Compiler
    extends Object
    This class performs the compilation operation in expression evaluation process.
    It parses the expression using Parser, which returns it list of expression tokens as per rules specified with DefaultXMLGrammar. Compiler restructure these tokens in Reverse Polish Notation and then create the Expression Object's tree for all the tokens. TODO Precedence can be stored with Token itself during parsing process - probably not much benefit as precedence is not used repeatedly can we set operator, function etc values to token itself from parsing process? Give example of expression compilation and expression tree
    Since:
    3.1
    • Constructor Detail

      • Compiler

        public Compiler()
        Constructs the Compiler with default DefaultXMLGrammar Instance
      • Compiler

        public Compiler​(Grammar grammar)
        Constructs the Compiler with specified DefaultXMLGrammar instance.
        Parameters:
        grammar - the grammar using which compiler will parse the expression
        Throws:
        IllegalArgumentException - if the grammar object is null