Next: Rule methods, Previous: Grammar reference counting, Up: Grammar methods [Contents][Index]
When successful, returns the ID of the start symbol.
Soft fails, if there is no start symbol.
The start symbol is set by the
marpa_g_start_symbol_set()
call.
Return value: On success, the ID of the start symbol, which is always a non-negative number. On soft failure, -1. On hard failure, -2.
When successful, sets the start symbol of grammar g to symbol sym_id. Soft fails if sym_id is well-formed (a non-negative integer), but a symbol with that ID does not exist.
Return value: On success, sym_id, which will always be a non-negative number. On soft failure, -1. On hard failure, -2.
Return value: On success, the numerically largest symbol ID of g. On hard failure, -2.
A symbol is accessible if it can be reached from the start symbol. Soft fails if sym_id is well-formed (a non-negative integer), but a symbol with that ID does not exist. A common hard failure is calling this method with a grammar that is not precomputed.
Return value: On success, 1 if symbol sym_id is accessible, 0 if not. On soft failure, -1. On hard failure, -2.
A symbol is nullable if it sometimes produces the empty string. A nulling symbol is always a nullable symbol, but not all nullable symbols are nulling symbols. Soft fails if sym_id is well-formed (a non-negative integer), but a symbol with that ID does not exist. A common hard failure is calling this method with a grammar that is not precomputed.
Return value: On success, 1 if symbol sym_id is nullable, 0 if not. On soft failure, -1. On hard failure, -2.
A symbol is nulling if it always produces the empty string. Soft fails if sym_id is well-formed (a non-negative integer), but a symbol with that ID does not exist. A common hard failure is calling this method with a grammar that is not precomputed.
Return value: On success, 1 if symbol sym_id is nulling, 0 if not. On soft failure, -1. On hard failure, -2.
A symbol is productive if it can produce a string of terminals. All nullable symbols are considered productive. Soft fails if sym_id is well-formed (a non-negative integer), but a symbol with that ID does not exist. A common hard failure is calling this method with a grammar that is not precomputed.
Return value: On success, 1 if symbol sym_id is productive, 0 if not. On soft failure, -1. On hard failure, -2.
On success, if sym_id is the start symbol, returns 1. On success, if sym_id is not the start symbol, returns 0. On success, if no start symbol has been set, returns 0. is the start symbol.
Soft fails if sym_id is well-formed (a non-negative integer), but a symbol with that ID does not exist.
Return value: On success, 1 or 0. On soft failure, -1. On hard failure, -2.
On succcess, returns the “terminal status” of a sym_id.
The terminal status is 1 if sym_id is a terminal,
0 otherwise.
To be used as an input symbol
in the
marpa_r_alternative()
method,
a symbol must be a terminal.
Soft fails if sym_id is well-formed (a non-negative integer), but a symbol with that ID does not exist.
Return value: On success, 1 or 0. On soft failure, -1. On hard failure, -2.
When successful, creates a new symbol in grammar g. The symbol ID’s are non-negative integers. Within each grammar, a symbol’s ID is unique to that symbol.
Symbols are numbered consecutively, starting at 0.
That is, the first successful call of this method for a grammar returns the symbol
with ID 0.
The n’th successful call returns the symbol for a grammar
with ID n-1
.
This makes it convenient for applications to store additional information
about the symbols in an array.
Return value: On success, the ID of the new symbol, which will be a non-negative integer. On hard failure, -2.
Next: Rule methods, Previous: Grammar reference counting, Up: Grammar methods [Contents][Index]