Wiki page
[Semantic values] by
aku
2017-10-01 05:24:53.
D 2017-10-01T05:24:53.996
L Semantic\svalues
N text/x-markdown
P fae99244dc6758fff0f27798516e1a9616d19f04
U aku
W 2060
This is about the [array descriptor](http://search.cpan.org/~jkegl/Marpa-R2-3.000000/pod/Semantics.pod#Array_descriptor_actions) 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)
Z e6118f87874bccaf807123c76f39c036