Interface SymbolFactory

  • All Known Implementing Classes:
    ComplexSymbolFactory, DefaultSymbolFactory

    public interface SymbolFactory
    Creates the Symbols interface, which CUP uses as default
    Version:
    last updated 27-03-2006
    Author:
    Michael Petter
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Symbol newSymbol​(java.lang.String name, int id)
      newSymbol creates a basic symbol; used frequently for terminal symbols, like keywords
      Symbol newSymbol​(java.lang.String name, int id, Symbol left, Symbol right)
      newSymbol creates a symbol, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
      Symbol newSymbol​(java.lang.String name, int id, Symbol left, Symbol right, java.lang.Object value)
      newSymbol creates a symbol with a value, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
      Symbol newSymbol​(java.lang.String name, int id, Symbol left, java.lang.Object value)
      newSymbol creates a symbol for an empty production, taking its location from the Symbol on the left
      Symbol newSymbol​(java.lang.String name, int id, java.lang.Object value)
      newSymbol creates a basic symbol with an attached value; used frequently for terminal symbols like identifiers
      Symbol startSymbol​(java.lang.String name, int id, int state)
      newSymbol creates the start symbol
    • Method Detail

      • newSymbol

        Symbol newSymbol​(java.lang.String name,
                         int id,
                         Symbol left,
                         Symbol right,
                         java.lang.Object value)
        newSymbol creates a symbol with a value, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        left - symbol, to take the left location from
        right - symbol, to take the right location from
        value - value, attached to this symbol
      • newSymbol

        Symbol newSymbol​(java.lang.String name,
                         int id,
                         Symbol left,
                         Symbol right)
        newSymbol creates a symbol, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        left - symbol, to take the left location from
        right - symbol, to take the right location from
      • newSymbol

        Symbol newSymbol​(java.lang.String name,
                         int id,
                         Symbol left,
                         java.lang.Object value)
        newSymbol creates a symbol for an empty production, taking its location from the Symbol on the left
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        left - symbol, to take the left location from
        value - value, attached to this symbol
      • newSymbol

        Symbol newSymbol​(java.lang.String name,
                         int id,
                         java.lang.Object value)
        newSymbol creates a basic symbol with an attached value; used frequently for terminal symbols like identifiers
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        value - value, attached to this symbol
      • newSymbol

        Symbol newSymbol​(java.lang.String name,
                         int id)
        newSymbol creates a basic symbol; used frequently for terminal symbols, like keywords
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        value - value, attached to this symbol
      • startSymbol

        Symbol startSymbol​(java.lang.String name,
                           int id,
                           int state)
        newSymbol creates the start symbol
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        left - symbol, to take the left location from
        right - symbol, to take the right location from
        value - value, attached to this symbol