Previous: , Up: Input   [Contents]


4.2 Terminals

A terminal symbol is a symbol which may appear in the input. Traditionally, all LHS symbols, as well as the start symbol, must be non-terminals. This is Marpa’s behavior, by default.

Marpa allows the user to eliminate the distinction between terminals and non-terminals. In this, it differs from traditional parsers. Libmarpa can arrange for a terminal to appear on the LHS of one or more rules, or for a terminal to be the start symbol. However, since terminals can never be zero length, it is a logical contradiction for a nulling symbol to also be a terminal and Marpa does not allow it.

Token values are int’s. Libmarpa does nothing with token values except accept them from the application and return them during parse evaluation.