Up: Notes
Reference
Scanless DSL as of 2017-02-23
Found Marpa.R2.DSL.Structure. TODO: Check against my tables below.
Comparison charts
Notes and questions
- A close reading of
DSL.pod
is necessary to find that empty rules are considered to be a special case of an rhs alternative. See Scanless DSL: empty rule
IMHO this part needs an emphasis of some kind, as it makes reading the remainder of the document easier, whenever it talks about RHS alternatives.
The role of quantified rules should be clarified too I believe. In some places I believe that an adverb applies to quantified rules as well, with this not explicitly stated (See "name", "action", "bless").
It should be noted that while some of the descriptions of adverbs and context cross-confirm each other, not all them do. I will use the marker XREF whereever I put information into a table which came from the other description and is thus not cross-confirmed.
On another note, while the provided meta-grammer using a single set of rules for the adverbs, thus moving validation of their applicability past the parser, I see it as possible to give each context its own variant of
<adverb list>
which references only the allowed adverbs for that context. That way there is no need to validate past the parser, the grammar ensured it already. And this would be a third cross-check against the human-readable descriptions.
Strongly tempted to make that happen here.
- "The action adverb is allowed for An RHS alternative, in which the action is for the alternative."
This feels incomplete. Nothing is said about quantified rules. While empty rules are not mentioned either
Note also that it is explicitly specified to not be allowed for L0 rules at all.
- Technically it seems that rules with precedence are possible for L0. It does not really make sense, as the structure of the matched lexeme will not be affected by this, but still.
So, is the "assoc" adverb allowed in L0 priority rule/alternatives ?
Is the "name" adverb allowed for quantified rules ?
Nothing is said at all about where the "rank" adverb is allowed, or not.
Adverbs
Adverb | Notes |
---|---|
action | Scanless DSL: action |
association | Scanless DSL: assoc |
bless | Scanless DSL: bless |
event | Scanless DSL: event |
latm | Scanless DSL: latm |
name | Scanless DSL: name |
null-ranking | Scanless DSL: null-ranking |
pause | Scanless DSL: pause |
priority | Scanless DSL: priority |
proper | Scanless DSL: proper |
rank | Scanless DSL: rank |
separator | Scanless DSL: separator |
Adverb contexts
Context | Notes |
---|---|
:default | Scanless DSL: :default |
:discard | Scanless DSL: :discard |
:lexeme | Scanless DSL: :lexeme |
discard default | Scanless DSL: discard default |
g1 alternative | Scanless DSL: alternative |
g1 empty rule | Scanless DSL: empty rule |
g1 quant. rule | Scanless DSL: quantified rule |
l0 alternative | Scanless DSL: alternative |
l0 empty rule | Scanless DSL: empty rule |
l0 quant. rule | Scanless DSL: quantified rule |
lexeme default | Scanless DSL: lexeme default |
Adverbs versus possible contexts
Note that empty rules are not considered separately here due to them being a special case of an RHS alternative. That makes the table a bit shorter.
Adverb | Context | Notes |
---|---|---|
action | Scanless DSL: action | |
:default | yes (XREF: G1) | |
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | yes - Applies to the alternative | |
g1 quant. rule | XREF: yes | |
l0 alternative | no | |
l0 quant. rule | no | |
lexeme default | yes - For all lexemes which do not specifically set their own | |
association | Scanless DSL: assoc | |
:default | ||
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | yes | |
g1 quant. rule | ||
l0 alternative | ||
l0 quant. rule | ||
lexeme default | ||
bless | Scanless DSL: bless | |
:default | XREF: yes, G1 | |
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | ? XREF: yes | |
g1 quant. rule | ? | |
l0 alternative | ? | |
l0 quant. rule | ? | |
lexeme default | XREF: yes | |
event | Scanless DSL: event | |
:default | ||
:discard | XREF: yes, discard event | |
:lexeme | yes - Names the event for 'pause'. Error if 'pause' is missing. | |
discard default | XREF: yes | |
g1 alternative | ||
g1 quant. rule | ||
l0 alternative | ||
l0 quant. rule | ||
lexeme default | ||
latm | Scanless DSL: latm | |
:default | ||
:discard | ||
:lexeme | yes | |
discard default | ||
g1 alternative | ||
g1 quant. rule | ||
l0 alternative | ||
l0 quant. rule | ||
lexeme default | yes | |
name | Scanless DSL: name | |
:default | ||
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | yes | |
g1 quant. rule | ||
l0 alternative | yes | |
l0 quant. rule | ||
lexeme default | ||
null-ranking | Scanless DSL: null-ranking | |
:default | ||
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | ||
g1 quant. rule | yes | |
l0 alternative | no | |
l0 quant. rule | no | |
lexeme default | ||
pause | Scanless DSL: pause | |
:default | ||
:discard | ||
:lexeme | yes - Declares a parse event. (Self: Warn if "event" is missing, unnamed events are strongly discouraged) | |
discard default | ||
g1 alternative | ||
g1 quant. rule | ||
l0 alternative | ||
l0 quant. rule | ||
lexeme default | ||
priority | Scanless DSL: priority | |
:default | ||
:discard | ||
:lexeme | yes | |
discard default | ||
g1 alternative | ||
g1 quant. rule | ||
l0 alternative | ||
l0 quant. rule | ||
lexeme default | ||
proper | Scanless DSL: proper | |
:default | ||
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | ||
g1 quant. rule | yes - Ignored if there is no "separator". (Self: Add warning) | |
l0 alternative | ||
l0 quant. rule | yes - Ignored if there is no "separator". (Self: Add warning) | |
lexeme default | ||
rank | Scanless DSL: rank | |
:default | ||
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | ||
g1 quant. rule | ||
l0 alternative | ||
l0 quant. rule | ||
lexeme default | ||
separator | Scanless DSL: separator | |
:default | ||
:discard | ||
:lexeme | ||
discard default | ||
g1 alternative | ||
g1 quant. rule | yes | |
l0 alternative | ||
l0 quant. rule | yes | |
lexeme default |
Possible contexts versus adverbs
Context | Adverb | Notes |
---|---|---|
:default | Scanless DSL: :default | |
action | yes - Affects G1 rules | |
association | ||
bless | yes - Affects G1 rules | |
event | ||
latm | ||
name | ||
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator | ||
:discard | Scanless DSL: :discard | |
action | ||
association | ||
bless | ||
event | yes - L0 - Implies a pause (discard event only) | |
latm | ||
name | ||
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator | ||
:lexeme | Scanless DSL: :lexeme | |
action | ||
association | ||
bless | ||
event | yes - L0 - If specified, pause has to be as well. Error if not | |
latm | XREF: yes | |
name | ||
null-ranking | ||
pause | yes - L0 - If specified, event should be as well. Unnamed events are discouraged | |
priority | yes | |
proper | ||
rank | ||
separator | ||
discard default | Scanless DSL: discard default | |
action | ||
association | ||
bless | ||
event | yes | |
latm | ||
name | ||
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator | ||
g1 alternative | Scanless DSL: Alternatives | |
action | yes | |
association | yes | |
bless | yes | |
event | ||
latm | ||
name | XREF: yes | |
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator | ||
g1 empty rule | Scanless DSL: Empty rules | |
action | yes | |
association | XREF: yes | |
bless | yes | |
event | ||
latm | ||
name | XREF: yes | |
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator | ||
g1 quant. rule | Scanless DSL: Quantified | |
action | yes | |
association | ||
bless | yes | |
event | ||
latm | ||
name | ||
null-ranking | ||
pause | ||
priority | ||
proper | yes | |
rank | ||
separator | yes | |
l0 alternative | Scanless DSL: Alternatives | |
action | XREF: no | |
association | yes__?__ | |
bless | ||
event | ||
latm | ||
name | XREF: yes | |
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator | ||
l0 empty rule | Scanless DSL: Empty rules | |
action | XREF: no | |
association | yes__?__ | |
bless | ||
event | ||
latm | ||
name | XREF: yes | |
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator | ||
l0 quant. rule | Scanless DSL: Quantified | |
action | XREF: no | |
association | ||
bless | ||
event | ||
latm | ||
name | ||
null-ranking | ||
pause | ||
priority | ||
proper | yes | |
rank | ||
separator | yes | |
lexeme default | Scanless DSL: lexeme default | |
action | yes - L0 | |
association | ||
bless | yes - L0 | |
event | ||
latm | yes - L0 | |
name | ||
null-ranking | ||
pause | ||
priority | ||
proper | ||
rank | ||
separator |