Marpa

Semantic values
Login

Semantic values

Tcl 2016 Conference, Houston/TX, US, Nov 14-18
Send your abstracts to tclconference@googlegroups.com by Sep 12.

This is about the array descriptor semantics where a series of keywords specifies the information to place into the SV.

Generally, each keyword places a single piece of information into the SV. The resulting SV is a Tcl list (Perl array) with the placed pieces as elements, in the same order as the keywords occurred in the semantics.

L0 semantics

Key Meaning Notes
g1length Length of the lexeme in G1 locations Usually 1 for standard token stream
g1start G1 start location of the lexeme How to get? Reach forward to G1 engine at time of lexeme creation?
length Length of lexeme in characters (or bytes)
start Start of lexeme in input stream, as character/byte offset
lhs G1 symbol (terminal) id of the lexeme
name G1 symbol (terminal) name of the lexeme
rule ??? Undefined for lexemes?
symbol See name This identity is specific to lexemes
value Token value (i.e. string) of the lexeme
values See value

G1 semantics

Key Meaning Notes
g1length Length of matched G1 rule (marpa_v_es_id()-marpa_v_rule_start_es_id()+1) (length of rhs works only if all tokens are length 1, i.e. standard token stream)
g1start G1 start location of the rule marpa_v_rule_start_es_id()
length Length of rule in characters/bytes How to get?
start L0 start location of the rule in chars/bytes How to get?
lhs G1 lhs symbol id for the rule Precomputable (map: rule id --> symbol id)
name User-specified rule name, or G1 lhs symbol name Precomputable (map: rule id --> rule name)
rule G1 rule id marpa_v_rule()
symbol G1 lhs symbol name See also name; Precomputable (map: rule id --> lhs name)
value Array of the rule rhs values
values See value

Step accessors (Marpa_Value accessors)