1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-17 07:40:47 +03:00

Changeover to new Preform notation 3

This commit is contained in:
Graham Nelson 2020-07-28 12:29:51 +01:00
parent a4d475be9d
commit abf51cb170
37 changed files with 343 additions and 332 deletions

View file

@ -121,21 +121,21 @@ overlapping with this, and they need to match.
=
<control-structure-phrase> ::=
if ... is begin | ==> 0; *XP = switch_CSP
if ... is | ==> 0; *XP = switch_CSP
if/unless ... | ==> 0; *XP = if_CSP
repeat ... | ==> 0; *XP = repeat_CSP
while ... | ==> 0; *XP = while_CSP
else/otherwise | ==> 0; *XP = otherwise_CSP
else/otherwise if/unless ... | ==> 0; *XP = otherwise_if_CSP
else/otherwise ... | ==> 0; *XP = abbreviated_otherwise_CSP
-- otherwise | ==> 0; *XP = default_case_CSP
-- ... ==> 0; *XP = case_CSP
if ... is begin | ==> { -, switch_CSP }
if ... is | ==> { -, switch_CSP }
if/unless ... | ==> { -, if_CSP }
repeat ... | ==> { -, repeat_CSP }
while ... | ==> { -, while_CSP }
else/otherwise | ==> { -, otherwise_CSP }
else/otherwise if/unless ... | ==> { -, otherwise_if_CSP }
else/otherwise ... | ==> { -, abbreviated_otherwise_CSP }
-- otherwise | ==> { -, default_case_CSP }
-- ... ==> { -, case_CSP }
<end-control-structure-phrase> ::=
end if/unless | ==> 0; *XP = if_CSP
end while | ==> 0; *XP = while_CSP
end repeat ==> 0; *XP = repeat_CSP
end if/unless | ==> { -, if_CSP }
end while | ==> { -, while_CSP }
end repeat ==> { -, repeat_CSP }
<other-significant-phrase> ::=
say ... | ==> { SAY_SIGF, - }

View file

@ -1,12 +1,12 @@
100.0% in inform7 run
66.8% in compilation to Inter
66.5% in compilation to Inter
24.8% in //Phrases::Manager::compile_first_block//
9.0% in //Phrases::Manager::compile_as_needed//
8.8% in //Phrases::Manager::compile_as_needed//
7.3% in //Strings::compile_responses//
6.5% in //World::Compile::compile//
3.3% in //Assertions::Traverse::traverse1//
3.3% in //Sentences::VPs::traverse//
2.2% in //Phrases::Manager::RulePrintingRule_routine//
2.1% in //Phrases::Manager::RulePrintingRule_routine//
2.1% in //Phrases::Manager::rulebooks_array//
1.0% in //NewVerbs::ConjugateVerb//
0.8% in //Phrases::Manager::traverse//
@ -26,17 +26,19 @@
0.1% in //Sentences::RuleSubtrees::register_recently_lexed_phrases//
0.1% in //World::complete_additions//
2.8% not specifically accounted for
31.0% in running Inter pipeline
31.2% in running Inter pipeline
10.6% in step preparation
10.2% in inter step 2/12: link
7.3% in inter step 12/12: generate inform6 -> auto.inf
7.6% in inter step 12/12: generate inform6 -> auto.inf
0.3% in inter step 9/12: make-identifiers-unique
0.2% in inter step 10/12: reconcile-verbs
0.2% in inter step 11/12: eliminate-redundant-labels
0.2% in inter step 6/12: assimilate
0.2% in inter step 7/12: resolve-external-symbols
0.1% in inter step 3/12: merge-template <- none
0.1% in inter step 4/12: parse-linked-matter
0.1% in inter step 5/12: resolve-conditional-compilation
0.1% in inter step 8/12: inspect-plugs
1.2% not specifically accounted for
2.1% in supervisor
1.0% not specifically accounted for
2.0% in supervisor
0.3% not specifically accounted for

View file

@ -238,7 +238,7 @@ the chimp is either not hairy or not an animal.
<s-adjective-list-unarticled> ::=
not <s-adjective> | ==> 0; *XP = Node::AdjectiveLists::negate_adjlist(RP[1])
<s-adjective> | ==> 0; *XP = RP[1]
<s-adjective> | ==> { 0, RP[1] }
not <s-adjective> <s-adjective-list-unarticled> | ==> 0; *XP = Node::AdjectiveLists::join_adjlist(Node::AdjectiveLists::negate_adjlist(RP[1]), RP[2])
<s-adjective> <s-adjective-list-unarticled> ==> 0; *XP = Node::AdjectiveLists::join_adjlist(RP[1], RP[2])

View file

@ -70,9 +70,9 @@ void Properties::SettingRelations::fix_property_bp(binary_predicate *bp) {
=
<relation-property-name> ::=
<either-or-property-name> | ==> @<Issue PM_RelationWithEitherOrProperty problem@>
<value-property-name> | ==> TRUE; *XP = RP[1];
... ==> @<Issue PM_RelationWithBadProperty problem@>
<either-or-property-name> | ==> @<Issue PM_RelationWithEitherOrProperty problem@>
<value-property-name> | ==> { TRUE, RP[1] }
... ==> @<Issue PM_RelationWithBadProperty problem@>
@<Issue PM_RelationWithEitherOrProperty problem@> =
*X = FALSE;

View file

@ -60,7 +60,7 @@ isn't expressed in this grammar.
<literal-list-entry> ==> 0; *XP = Lists::add_to_ll(RP[1], Lists::empty_literal_list(W), W, R[1])
<literal-list-entry> ::=
<s-value> | ==> FALSE; *XP = RP[1]
<s-value> | ==> { FALSE, RP[1] }
...... ==> TRUE; *XP = Specifications::new_UNKNOWN(W)
@ The grammar above builds our list structures from the bottom up. They begin

View file

@ -230,9 +230,9 @@ what looks like text into grammar for parsing.
=
<table-column-heading> ::=
( *** ) | ==> @<Issue PM_TableColumnBracketed problem@>
<s-table-column-name> ( ... ) | ==> EXISTING_TC; *XP = RP[1]; <<k1>> = Wordings::first_wn(WR[1]); <<k2>> = Wordings::last_wn(WR[1]);
<s-table-column-name> ( ... ) | ==> { EXISTING_TC, RP[1] }; <<k1>> = Wordings::first_wn(WR[1]); <<k2>> = Wordings::last_wn(WR[1]);
<table-column-heading-unbracketed> ( ... ) | ==> R[1]; if (R[1] != NEW_TC_PROBLEM) *X = NEW_TC_WITH_KIND; <<k1>> = Wordings::first_wn(WR[1]); <<k2>> = Wordings::last_wn(WR[1]);
<s-table-column-name> | ==> EXISTING_TC; *XP = RP[1]; <<k1>> = -1; <<k2>> = -1;
<s-table-column-name> | ==> { EXISTING_TC, RP[1] }; <<k1>> = -1; <<k2>> = -1;
<table-column-heading-unbracketed> ==> { pass 1 }
<table-column-heading-unbracketed> ::=

View file

@ -26,9 +26,9 @@ The subject must match:
=
<defined-by-sentence-subject> ::=
kind/kinds of <s-type-expression> | ==> TRUE; *XP = RP[1]
<s-type-expression> | ==> TRUE; *XP = RP[1]
... ==> @<Issue PM_TableDefiningTheImpossible problem@>
kind/kinds of <s-type-expression> | ==> { TRUE, RP[1] }
<s-type-expression> | ==> { TRUE, RP[1] }
... ==> @<Issue PM_TableDefiningTheImpossible problem@>
@<Issue PM_TableDefiningTheImpossible problem@> =
*X = FALSE;
@ -86,7 +86,7 @@ whatever is named in column 1.
=
<defined-by-sentence-object> ::=
defined by <np-as-object> ==> TRUE; *XP = RP[1]
defined by <np-as-object> ==> { pass 1 }
@ =
int Tables::Defining::defined_by_SMF(int task, parse_node *V, wording *NPs) {
@ -95,7 +95,6 @@ int Tables::Defining::defined_by_SMF(int task, parse_node *V, wording *NPs) {
switch (task) { /* "The colours are defined by Table 1." */
case ACCEPT_SMFT:
if (<defined-by-sentence-object>(OW)) {
if (<<r>> == FALSE) return FALSE;
Annotations::write_int(V, verb_id_ANNOT, SPECIAL_MEANING_VB);
Annotations::write_int(V, examine_for_ofs_ANNOT, TRUE);
parse_node *O = <<rp>>;

View file

@ -851,7 +851,7 @@ us issue more contextual problem messages.
<table-cell> ::=
<table-cell-blank> | ==> @<Make anomalous entry for blank@>
<k-kind-articled> | ==> @<Make anomalous entry for kind@>
<s-named-constant> | ==> NAMED_CONSTANT_ENTRY; *XP = RP[1]
<s-named-constant> | ==> { NAMED_CONSTANT_ENTRY, RP[1] }
<s-global-variable> | ==> @<Issue PM_TablePlayerEntry or C20TableVariableEntry problem@>
<table-cell-value> | ==> { pass 1 }
<list-of-double-quotes> | ==> @<Make anomalous entry for text to be understood@>
@ -861,12 +861,12 @@ us issue more contextual problem messages.
--
<table-cell-value> ::=
the action of <s-constant-action> | ==> ACTION_TABLE_ENTRY; *XP = RP[1]
<s-constant-action> | ==> ACTION_TABLE_ENTRY; *XP = RP[1]
the action of <s-constant-action> | ==> { ACTION_TABLE_ENTRY, RP[1] }
<s-constant-action> | ==> { ACTION_TABLE_ENTRY, RP[1] }
the action of <s-explicit-action> | ==> @<Issue PM_NonconstantActionInTable problem@>
<s-explicit-action> | ==> @<Issue PM_NonconstantActionInTable problem@>
<instance-of-non-object> | ==> INSTANCE_TABLE_ENTRY; *XP = Rvalues::from_instance(RP[1])
<s-type-expression> ==> SPEC_TABLE_ENTRY; *XP = RP[1]
<s-type-expression> ==> { SPEC_TABLE_ENTRY, RP[1] }
<list-of-double-quotes> ::=
<quoted-text> or <list-of-double-quotes> |

View file

@ -371,25 +371,25 @@ mass, too.
=
<equation-where-list> ::=
... | ==> 0; eq_symbol_wn = Wordings::first_wn(W); return preform_lookahead_mode; /* match only when looking ahead */
<equation-where-setting-entry> <equation-where-tail> | ==> { 0, - }
<equation-where-setting-entry> ==> { 0, - }
... | ==> { 0, - }; eq_symbol_wn = Wordings::first_wn(W); return preform_lookahead_mode; /* match only when looking ahead */
<equation-where-setting-entry> <equation-where-tail> | ==> { 0, - }
<equation-where-setting-entry> ==> { 0, - }
<equation-where-tail> ::=
, _and <equation-where-list> | ==> { 0, - }
_,/and <equation-where-list> ==> { 0, - }
, _and <equation-where-list> | ==> { 0, - }
_,/and <equation-where-list> ==> { 0, - }
<equation-where-setting-entry> ::=
<equation-where-setting> ==> 0; if (!preform_lookahead_mode) Equations::eqn_dec_var(equation_being_declared, Wordings::one_word(eq_symbol_wn), R[1], RP[1]);
<equation-where-setting> ==> 0; if (!preform_lookahead_mode) Equations::eqn_dec_var(equation_being_declared, Wordings::one_word(eq_symbol_wn), R[1], RP[1]);
<equation-where-setting> ::=
<equation-symbol> is/are <k-kind> | ==> EQW_IDENTIFIES_KIND; *XP = RP[2]; eq_symbol_wn = R[1];
<equation-symbol> is/are <s-value> | ==> EQW_IDENTIFIES_VALUE; *XP = RP[2]; eq_symbol_wn = R[1];
<equation-symbol> is/are ... | ==> @<Issue PM_EquationSymbolNonValue problem@>
<equation-symbol> = <k-kind> | ==> @<Issue PM_EquationSymbolEqualsKOV problem@>
<equation-symbol> = <s-value> | ==> EQW_IDENTIFIES_VALUE; *XP = RP[2]; eq_symbol_wn = R[1];
<equation-symbol> = ... | ==> @<Issue PM_EquationSymbolNonValue problem@>
<equation-symbol> ==> EQW_IDENTIFIES_NOTHING; eq_symbol_wn = R[1];
<equation-symbol> is/are <k-kind> | ==> { EQW_IDENTIFIES_KIND, RP[2] }; eq_symbol_wn = R[1];
<equation-symbol> is/are <s-value> | ==> { EQW_IDENTIFIES_VALUE, RP[2] }; eq_symbol_wn = R[1];
<equation-symbol> is/are ... | ==> @<Issue PM_EquationSymbolNonValue problem@>
<equation-symbol> = <k-kind> | ==> @<Issue PM_EquationSymbolEqualsKOV problem@>
<equation-symbol> = <s-value> | ==> { EQW_IDENTIFIES_VALUE, RP[2] }; eq_symbol_wn = R[1];
<equation-symbol> = ... | ==> @<Issue PM_EquationSymbolNonValue problem@>
<equation-symbol> ==> { EQW_IDENTIFIES_NOTHING, NULL }; eq_symbol_wn = R[1];
<equation-symbol> ::=
<valid-equation-symbol> | ==> { pass 1 }

View file

@ -451,17 +451,17 @@ it mentions no activities.
=
<run-time-context> ::=
not <activity-list-unnegated> | ==> 0; *XP = RP[1]; @<Flip the activity list parities@>;
<activity-list-unnegated> ==> 0; *XP = RP[1]
not <activity-list-unnegated> | ==> { 0, RP[1] }; @<Flip the activity list parities@>;
<activity-list-unnegated> ==> { 0, RP[1] }
<activity-list-unnegated> ::=
... | ==> 0; return preform_lookahead_mode; /* match only when looking ahead */
<activity-list-entry> <activity-tail> | ==> @<Join the activity lists@>;
<activity-list-entry> ==> 0; *XP = RP[1]
<activity-list-entry> ==> { 0, RP[1] }
<activity-tail> ::=
, _or <run-time-context> | ==> 0; *XP = RP[1]
_,/or <run-time-context> ==> 0; *XP = RP[1]
, _or <run-time-context> | ==> { 0, RP[1] }
_,/or <run-time-context> ==> { 0, RP[1] }
<activity-list-entry> ::=
<activity-name> | ==> @<Make one-entry AL without operand@>
@ -482,7 +482,7 @@ values, of the kind to which the activity applies.
<activity-operand> ::=
something/anything | ==> FALSE; *XP = Specifications::new_UNKNOWN(W);
something/anything else | ==> FALSE; *XP = Specifications::new_UNKNOWN(W);
<s-type-expression-or-value> ==> TRUE; *XP = RP[1]
<s-type-expression-or-value> ==> { TRUE, RP[1] }
@<Flip the activity list parities@> =
activity_list *al = *XP;

View file

@ -47,8 +47,8 @@ optionally be used.)
=
<listed-in-sentence-object> ::=
listed <np-unparsed> | ==> TRUE; *XP = RP[1];
not listed <np-unparsed> ==> FALSE; *XP = RP[1];
listed <np-unparsed> | ==> { TRUE, RP[1] }
not listed <np-unparsed> ==> { FALSE, RP[1] }
@ =
int Rules::Placement::listed_in_SMF(int task, parse_node *V, wording *NPs) {
@ -84,7 +84,7 @@ following won't pick up many false positives.
<nounphrase-rule-list> ::=
... | ==> 0; *XP = NULL; return preform_lookahead_mode; /* match only when looking ahead */
<nounphrase-rule> <np-rule-tail> | ==> 0; *XP = Diagrams::new_AND(R[2], RP[1], RP[2])
<nounphrase-rule> ==> 0; *XP = RP[1]
<nounphrase-rule> ==> { 0, RP[1] }
<np-rule-tail> ::=
, {_and} <nounphrase-rule-list> | ==> Wordings::first_wn(W); *XP= RP[1]
@ -97,9 +97,9 @@ following won't pick up many false positives.
=
<substitutes-for-sentence-object> ::=
<nounphrase-rule> | ==> NOT_APPLICABLE; *XP = RP[1];
<nounphrase-rule> if/when <np-unparsed> | ==> TRUE; *XP = RP[1]; ((parse_node *) RP[1])->next = RP[2];
<nounphrase-rule> unless <np-unparsed> ==> FALSE; *XP = RP[1]; ((parse_node *) RP[1])->next = RP[2];
<nounphrase-rule> | ==> { NOT_APPLICABLE, RP[1] }
<nounphrase-rule> if/when <np-unparsed> | ==> { TRUE, RP[1] }; ((parse_node *) RP[1])->next = RP[2];
<nounphrase-rule> unless <np-unparsed> ==> { FALSE, RP[1] }; ((parse_node *) RP[1])->next = RP[2];
@ =
int Rules::Placement::substitutes_for_SMF(int task, parse_node *V, wording *NPs) {
@ -139,11 +139,11 @@ subject and object NPs.
=
<substitutes-for-sentence-subject> ::=
<rule-name> | ==> TRUE; *XP = RP[1];
<rule-name> | ==> { TRUE, RP[1] }
... ==> @<Issue PM_NoSuchRuleExists problem@>
<substitutes-for-sentence-object-inner> ::=
<rule-name> | ==> TRUE; *XP = RP[1];
<rule-name> | ==> { TRUE, RP[1] }
... ==> @<Issue PM_NoSuchRuleExists problem@>
@<Issue PM_NoSuchRuleExists problem@> =
@ -183,7 +183,7 @@ eventually match <spec-condition>.
nothing
<does-nothing-sentence-subject> ::=
<rule-name> | ==> TRUE; *XP = RP[1];
<rule-name> | ==> { TRUE, RP[1] }
... ==> @<Issue PM_NoSuchRuleExists problem@>
@ =
@ -284,7 +284,7 @@ The subject noun phrase is an articled list, each entry of which must match:
=
<listed-in-sentence-subject> ::=
<rule-name> | ==> TRUE; *XP = RP[1];
<rule-name> | ==> { TRUE, RP[1] }
... ==> FALSE; @<Issue PM_NoSuchRuleExists problem@>
@ The object NP is more flexible:
@ -310,7 +310,7 @@ The subject noun phrase is an articled list, each entry of which must match:
... ==> @<Issue PM_ImproperRulePlacement problem@>
<destination-rulebook> ::=
<rulebook-name> | ==> 0; *XP = RP[1];
<rulebook-name> | ==> { 0, RP[1] }
... ==> @<Issue PM_NoSuchRulebookPlacement problem@>
@

View file

@ -673,23 +673,23 @@ of the two outer words and is discontiguous.
=
<rulebook-stem-inner> ::=
<indefinite-article> <rulebook-stem-inner-unarticled> | ==> 0; *XP = RP[1]; <<place>> = R[2]
<definite-article> <rulebook-stem-inner-unarticled> | ==> 0; *XP = RP[1]; <<place>> = R[2]
<rulebook-stem-inner-unarticled> ==> 0; *XP = NULL; <<place>> = R[1]
<indefinite-article> <rulebook-stem-inner-unarticled> | ==> { 0, RP[1], <<place>> = R[2] }
<definite-article> <rulebook-stem-inner-unarticled> | ==> { 0, RP[1], <<place>> = R[2] }
<rulebook-stem-inner-unarticled> ==> { 0, NULL, <<place>> = R[1] }
<rulebook-stem-inner-unarticled> ::=
rule for/about/on <rulebook-stem-name> | ==> MIDDLE_PLACEMENT; <<len>> = R[1]
rule <rulebook-stem-name> | ==> MIDDLE_PLACEMENT; <<len>> = R[1]
first rule <rulebook-stem-name> | ==> FIRST_PLACEMENT; <<len>> = R[1]
first <rulebook-stem-name> | ==> FIRST_PLACEMENT; <<len>> = R[1]
last rule <rulebook-stem-name> | ==> LAST_PLACEMENT; <<len>> = R[1]
last <rulebook-stem-name> | ==> LAST_PLACEMENT; <<len>> = R[1]
<rulebook-stem-name> ==> MIDDLE_PLACEMENT; <<len>> = R[1]
rule for/about/on <rulebook-stem-name> | ==> { MIDDLE_PLACEMENT, -, <<len>> = R[1] }
rule <rulebook-stem-name> | ==> { MIDDLE_PLACEMENT, -, <<len>> = R[1] }
first rule <rulebook-stem-name> | ==> { FIRST_PLACEMENT, -, <<len>> = R[1] }
first <rulebook-stem-name> | ==> { FIRST_PLACEMENT, -, <<len>> = R[1] }
last rule <rulebook-stem-name> | ==> { LAST_PLACEMENT, -, <<len>> = R[1] }
last <rulebook-stem-name> | ==> { LAST_PLACEMENT, -, <<len>> = R[1] }
<rulebook-stem-name> ==> { MIDDLE_PLACEMENT, -, <<len>> = R[1] }
<rulebook-stem-name> ::=
{when ... begins} | ==> 2; <<rulebook:m>> = built_in_rulebooks[WHEN_SCENE_BEGINS_RB] /* scenes\_plugin */
{when ... ends} | ==> 2; <<rulebook:m>> = built_in_rulebooks[WHEN_SCENE_ENDS_RB] /* scenes\_plugin */
... ==> 0; <<rulebook:m>> = NULL
{when ... begins} | ==> { 2, -, <<rulebook:m>> = built_in_rulebooks[WHEN_SCENE_BEGINS_RB] }
{when ... ends} | ==> { 2, -, <<rulebook:m>> = built_in_rulebooks[WHEN_SCENE_ENDS_RB] }
... ==> { 0, -, <<rulebook:m>> = NULL }
@ =
rulebook_match Rulebooks::rb_match_from_description(wording W) {

View file

@ -523,17 +523,17 @@ haven't yet been parsed, so that we don't yet know it will be meaningful.
=
<to-return-data> ::=
to {decide yes/no} | ==> { DEC_RANN, - }
to {decide on ...} | ==> { DEV_RANN, - }
to decide whether/if the ... | ==> TOC_RANN
to decide whether/if ... | ==> { TOC_RANN, - }
to decide what/which <return-kind> is the ... | ==> TOV_RANN; *XP = RP[1]
to decide what/which <return-kind> is ... | ==> TOV_RANN; *XP = RP[1]
to ... ==> { TO_RANN, - }
to {decide yes/no} | ==> { DEC_RANN, NULL }
to {decide on ...} | ==> { DEV_RANN, NULL }
to decide whether/if the ... | ==> { TOC_RANN, NULL }
to decide whether/if ... | ==> { TOC_RANN, NULL }
to decide what/which <return-kind> is the ... | ==> { TOV_RANN, RP[1] }
to decide what/which <return-kind> is ... | ==> { TOV_RANN, RP[1] }
to ... ==> { TO_RANN, NULL }
<return-kind> ::=
<k-kind-for-template> | ==> 0; *XP = RP[1]
... ==> @<Issue PM_UnknownValueToDecide problem@>
<k-kind-for-template> | ==> { pass 1 }
... ==> @<Issue PM_UnknownValueToDecide problem@>
@<Issue PM_UnknownValueToDecide problem@> =
*XP = K_number;
@ -680,10 +680,10 @@ the hyphen, and this is sorely needed with complicated functional kinds.
...... - storage | ==> TRUE; *XP = Specifications::from_kind(K_value); Node::set_text(*XP, WR[2]); <<token-construct>> = STORAGE_PT_CONSTRUCT
...... - a table-reference | ==> TRUE; *XP = Specifications::from_kind(K_value); Node::set_text(*XP, WR[2]); <<token-construct>> = TABLE_REFERENCE_PT_CONSTRUCT
...... - table-reference | ==> TRUE; *XP = Specifications::from_kind(K_value); Node::set_text(*XP, WR[2]); <<token-construct>> = TABLE_REFERENCE_PT_CONSTRUCT
...... - <s-phrase-token-type> | ==> TRUE; *XP = RP[1]; <<token-construct>> = STANDARD_PT_CONSTRUCT
...... - <s-kind-as-name-token> | ==> TRUE; *XP = RP[1]; <<token-construct>> = KIND_NAME_PT_CONSTRUCT
...... - <s-phrase-token-type> | ==> { TRUE, RP[1], <<token-construct>> = STANDARD_PT_CONSTRUCT }
...... - <s-kind-as-name-token> | ==> { TRUE, RP[1], <<token-construct>> = KIND_NAME_PT_CONSTRUCT }
...... - ...... | ==> @<Issue PM_BadTypeIndication problem@>
<s-kind-as-name-token> | ==> FALSE; *XP = RP[1]; <<token-construct>> = KIND_NAME_PT_CONSTRUCT
<s-kind-as-name-token> | ==> { FALSE, RP[1], <<token-construct>> = KIND_NAME_PT_CONSTRUCT }
...... ==> @<Issue PM_TokenMisunderstood problem@>
@<Issue PM_TokenWithEmptyBrackets problem@> =

View file

@ -749,14 +749,14 @@ name or a description.
=
<new-called-name> ::=
<definite-article> <new-called-name-unarticled> | ==> *X = R[2]; *XP = RP[2]
<new-called-name-unarticled> ==> *X = R[1]; *XP = RP[1]
<definite-article> <new-called-name-unarticled> | ==> { pass 2 }
<new-called-name-unarticled> ==> { pass 1 }
<new-called-name-unarticled> ::=
*** - *** | ==> @<Issue PM_CalledWithDash problem@>
<existing-local-name> | ==> *X = R[1]; *XP = RP[1]
<s-type-expression-or-value> | ==> @<Vet to see if this name can be overloaded@>
... ==> @<Make a new local for this calling@>
*** - *** | ==> @<Issue PM_CalledWithDash problem@>
<existing-local-name> | ==> { pass 1 }
<s-type-expression-or-value> | ==> @<Vet to see if this name can be overloaded@>
... ==> @<Make a new local for this calling@>
<existing-local-name> internal {
*XP = LocalVariables::parse(Frames::current_stack_frame(), W);
@ -765,13 +765,13 @@ name or a description.
}
@<Issue PM_CalledWithDash problem@> =
*X = 0; *XP = NULL;
if (!(Wordings::eq(PM_CalledWithDash_wording, W))) {
PM_CalledWithDash_wording = W;
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_CalledWithDash),
"a '(called ...)' name is not allowed to include a hyphen",
"since this would look misleadingly like a declaration of kind of value it has.");
}
==> { 0, NULL }
@<Vet to see if this name can be overloaded@> =
parse_node *already = <<rp>>;
@ -789,7 +789,7 @@ name or a description.
"will be called. But I can't allow that, because it already has a meaning "
"as %3.");
Problems::issue_problem_end();
*X = 0; *XP = NULL;
==> { 0, NULL }
} else return FALSE;
@<Make a new local for this calling@> =

View file

@ -108,11 +108,11 @@ void UseOptions::new_use_option(parse_node *p) {
=
<use-translates-as-sentence-subject> ::=
use <np-unparsed> ==> TRUE; *XP = RP[1]
use <np-unparsed> ==> { TRUE, RP[1] }
<use-translates-as-sentence-object> ::=
(- ### | ==> { TRUE, - }
... ==> @<Issue PM_UseTranslatesNotI6 problem@>
(- ### | ==> { TRUE, - }
... ==> @<Issue PM_UseTranslatesNotI6 problem@>
@<Issue PM_UseTranslatesNotI6 problem@> =
*X = FALSE;

View file

@ -7,8 +7,8 @@ The user gives us plurals with special sentences, whose subject is like so:
=
<plural-sentence-subject> ::=
<article> plural of <np-articled> | ==> TRUE; *XP = RP[2]
plural of <np-articled> ==> TRUE; *XP = RP[1]
<article> plural of <np-articled> | ==> { TRUE, RP[2] }
plural of <np-articled> ==> { TRUE, RP[1] }
@ We take immediate action on parsing the sentence, and after that ignore it
as having been dealt with.

View file

@ -2495,25 +2495,25 @@ of alternatives each of which matches the following:
=
<specifies-sentence-subject> ::=
... ( {<literal-pattern-group-list>} ) | ==> { pass 1 }
<k-kind-articled> times <k-kind-articled> | ==> TIMES_LPN; LP_left_kind = RP[1]; LP_right_kind = RP[2];
<s-type-expression> times <s-type-expression> | ==> @<Issue PM_MultiplyingNonKOVs problem@>
... ==> 0; *XP = NULL
... ( {<literal-pattern-group-list>} ) | ==> { pass 1 }
<k-kind-articled> times <k-kind-articled> | ==> TIMES_LPN; LP_left_kind = RP[1]; LP_right_kind = RP[2];
<s-type-expression> times <s-type-expression> | ==> @<Issue PM_MultiplyingNonKOVs problem@>
... ==> { 0, NULL }
<literal-pattern-group-list> ::=
<literal-pattern-group> <literal-pattern-group-tail> | ==> R[1] | R[2]; @<Compose LPG lists@>;
<literal-pattern-group> ==> { pass 1 }
<literal-pattern-group> <literal-pattern-group-tail> | ==> { R[1] | R[2], - }; @<Compose LPG lists@>;
<literal-pattern-group> ==> { pass 1 }
<literal-pattern-group-tail> ::=
, and <literal-pattern-group-list> | ==> { pass 1 }
,/and <literal-pattern-group-list> ==> { pass 1 }
, and <literal-pattern-group-list> | ==> { pass 1 }
,/and <literal-pattern-group-list> ==> { pass 1 }
<literal-pattern-group> ::=
singular | ==> SINGULAR_LPN; *XP = NULL;
plural | ==> PLURAL_LPN; *XP = NULL;
<literal-pattern-group-name> | ==> IN_LPN; *XP = LiteralPatterns::new_lpn(EMPTY_WORDING, RP[1]);
in ...... | ==> IN_LPN; *XP = LiteralPatterns::new_lpn(W, NULL);
...... ==> @<Issue PM_BadLPNameOption problem@>
singular | ==> { SINGULAR_LPN, NULL }
plural | ==> { PLURAL_LPN, NULL }
<literal-pattern-group-name> | ==> { IN_LPN, LiteralPatterns::new_lpn(EMPTY_WORDING, RP[1]) }
in ...... | ==> { IN_LPN, LiteralPatterns::new_lpn(W, NULL) }
...... ==> @<Issue PM_BadLPNameOption problem@>
@<Compose LPG lists@> =
*XP = RP[1];
@ -2521,15 +2521,14 @@ of alternatives each of which matches the following:
else if (RP[2]) ((literal_pattern_name *) RP[1])->next_with_rp = RP[2];
@<Issue PM_MultiplyingNonKOVs problem@> =
*X = ABANDON_LPN; *XP = NULL;
if (preform_lookahead_mode == FALSE) {
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_MultiplyingNonKOVs),
"only kinds of value can be multiplied here",
"and only in a sentence like 'A length times a length specifies an area.'");
}
==> { ABANDON_LPN, NULL }
@<Issue PM_BadLPNameOption problem@> =
*X = ABANDON_LPN; *XP = NULL;
if (preform_lookahead_mode == FALSE) {
Problems::quote_source(1, current_sentence);
Problems::quote_wording(2, W);
@ -2540,6 +2539,7 @@ of alternatives each of which matches the following:
"'plural' or 'in ...'.");
Problems::issue_problem_end();
}
==> { ABANDON_LPN, NULL }
@<Parse the object noun phrase of the specifies sentence@> =
LP_offset_value = NULL;
@ -2557,15 +2557,15 @@ can't set both scaling and an equivalent, for instance.
=
<specifies-sentence-object> ::=
<kind-specified> <literal-pattern-specification-tail> | ==> { pass 2 }
<kind-specified> ==> 0; *XP = NULL
<kind-specified> <literal-pattern-specification-tail> | ==> { pass 2 }
<kind-specified> ==> { 0, NULL }
<kind-specified> ::=
<k-kind-articled> | ==> 0; LP_kind_specified = RP[1];
... ==> @<Issue PM_LPNotKOV problem@>
<k-kind-articled> | ==> { 0, NULL }; LP_kind_specified = RP[1];
... ==> @<Issue PM_LPNotKOV problem@>
<literal-pattern-specification-tail> ::=
with parts <literal-pattern-part-list> | ==> PARTS_LPC; *XP = RP[1];
with parts <literal-pattern-part-list> | ==> { PARTS_LPC, RP[1] }
<scaling-instruction> | ==> { SCALING_LPC, - }
<scaling-instruction> offset by <s-literal> | ==> SCALING_LPC; LP_real_offset = latest_constructed_real; LP_offset_value = RP[2];
offset by <s-literal> | ==> OFFSET_LPC; LP_real_offset = latest_constructed_real; LP_offset_value = RP[1];
@ -2596,14 +2596,14 @@ by a bracketed list of up to three options in any order.
=
<literal-pattern-part-list> ::=
<literal-pattern-part> , and <literal-pattern-part-list> | ==> 0; *XP = RP[1]; if (RP[1]) ((parse_node *) RP[1])->next = RP[2];
<literal-pattern-part> , <literal-pattern-part-list> | ==> 0; *XP = RP[1]; if (RP[1]) ((parse_node *) RP[1])->next = RP[2];
<literal-pattern-part> and <literal-pattern-part-list> | ==> 0; *XP = RP[1]; if (RP[1]) ((parse_node *) RP[1])->next = RP[2];
<literal-pattern-part> ==> 0; *XP = RP[1]
<literal-pattern-part> , and <literal-pattern-part-list> | ==> { 0, RP[1] }; if (RP[1]) ((parse_node *) RP[1])->next = RP[2];
<literal-pattern-part> , <literal-pattern-part-list> | ==> { 0, RP[1] }; if (RP[1]) ((parse_node *) RP[1])->next = RP[2];
<literal-pattern-part> and <literal-pattern-part-list> | ==> { 0, RP[1] }; if (RP[1]) ((parse_node *) RP[1])->next = RP[2];
<literal-pattern-part> ==> { 0, RP[1] }
<literal-pattern-part> ::=
<np-unparsed-bal> ( <literal-pattern-part-option-list> ) | ==> 0; *XP = RP[1]; if (RP[1]) Annotations::write_int(*XP, lpe_options_ANNOT, R[2]);
<np-unparsed-bal> ==> 0; *XP = RP[1]
<np-unparsed-bal> ( <literal-pattern-part-option-list> ) | ==> { 0, RP[1] }; if (RP[1]) Annotations::write_int(*XP, lpe_options_ANNOT, R[2]);
<np-unparsed-bal> ==> { 0, RP[1] }
<literal-pattern-part-option-list> ::=
<literal-pattern-part-option> <literal-pattern-part-option-tail> | ==> R[1] | R[2]

View file

@ -117,8 +117,8 @@ and is a somewhat provisional feature for now.
=
<translates-into-nl-sentence-subject> ::=
<k-kind> | ==> TRANS_KIND; *XP = RP[1]
<instance> ==> TRANS_INSTANCE; *XP = RP[1]
<k-kind> | ==> { TRANS_KIND, RP[1] }
<instance> ==> { TRANS_INSTANCE, RP[1] }
@ =
void UseNouns::nl_translates(parse_node *pn) {

View file

@ -155,8 +155,8 @@ of the verb. Each one is matched against this:
=
<conjugation> ::=
<subject-pronoun> is/are ... | ==> 0; *XP = RP[1]; <<is-participle>> = TRUE
<subject-pronoun> ... ==> 0; *XP = RP[1]; <<is-participle>> = FALSE
<subject-pronoun> is/are ... | ==> { 0, RP[1], <<is-participle>> = TRUE }
<subject-pronoun> ... ==> { 0, RP[1], <<is-participle>> = FALSE }
@ This syntax was a design mistake. It generalises badly to other languages,
and doesn't even work perfectly for English. The problem is that the source
@ -185,7 +185,7 @@ now absolutely any non-empty word range is accepted as the property name.
=
<verb-implies-sentence-object> ::=
reversed <relation-name> relation | ==> REL_VERBM; *XP = BinaryPredicates::get_reversal(RP[1])
<relation-name> relation | ==> REL_VERBM; *XP = RP[1]
<relation-name> relation | ==> { REL_VERBM, RP[1] }
to <instance-of-infinitive-form> | ==> @<Use verb infinitive as shorthand@>
... property | ==> { PROP_VERBM, - }
built-in ... meaning | ==> { BUILTIN_VERBM, - }
@ -238,8 +238,8 @@ now absolutely any non-empty word range is accepted as the property name.
<new-verb-sentence-object-unarticled> ::=
verb | ==> TRUE; *XP = NULL;
verb implying/meaning <definite-article> nounphrase-unparsed> | ==> TRUE; *XP = RP[2]
verb implying/meaning <np-unparsed> ==> TRUE; *XP = RP[1]
verb implying/meaning <definite-article> nounphrase-unparsed> | ==> { TRUE, RP[2] }
verb implying/meaning <np-unparsed> ==> { TRUE, RP[1] }
@ =
int NewVerbs::new_verb_SMF(int task, parse_node *V, wording *NPs) {
@ -271,8 +271,8 @@ int NewVerbs::new_verb_SMF(int task, parse_node *V, wording *NPs) {
<verb-means-sentence-subject-unarticled> ::=
verb to | ==> { fail }
verb <np-unparsed> in the imperative | ==> TRUE; *XP = RP[1]
verb <np-unparsed> ==> FALSE; *XP = RP[1]
verb <np-unparsed> in the imperative | ==> { TRUE, RP[1] }
verb <np-unparsed> ==> { FALSE, RP[1] }
@ =
int NewVerbs::verb_means_SMF(int task, parse_node *V, wording *NPs) {
@ -1126,8 +1126,8 @@ int NewVerbs::takes_contraction_form(word_assemblage *wa) {
<new-adjective-sentence-object-unarticled> ::=
adjective | ==> TRUE; *XP = NULL
adjective implying/meaning <definite-article> <np-unparsed> | ==> TRUE; *XP = RP[2]
adjective implying/meaning <np-unparsed> ==> TRUE; *XP = RP[1]
adjective implying/meaning <definite-article> <np-unparsed> | ==> { TRUE, RP[2] }
adjective implying/meaning <np-unparsed> ==> { TRUE, RP[1] }
@ =
int NewVerbs::new_adjective_SMF(int task, parse_node *V, wording *NPs) {
@ -1156,8 +1156,8 @@ int NewVerbs::new_adjective_SMF(int task, parse_node *V, wording *NPs) {
@ =
<adjective-definition-subject> ::=
in <natural-language> ... | ==> TRUE; *XP = RP[1];
... ==> TRUE; *XP = Projects::get_language_of_play(Task::project());
in <natural-language> ... | ==> { TRUE, RP[1] }
... ==> { TRUE, Projects::get_language_of_play(Task::project()) }
@ =
void NewVerbs::declare_meaningless_adjective(parse_node *p) {

View file

@ -97,7 +97,7 @@ parse tree.
=
<new-relation-sentence-object> ::=
<np-unparsed> to <np-unparsed> ==> TRUE; *XP = RP[1]; ((parse_node *) RP[1])->next = RP[2];
<np-unparsed> to <np-unparsed> ==> { TRUE, RP[1] }; ((parse_node *) RP[1])->next = RP[2];
@ =
int Relations::new_relation_SMF(int task, parse_node *V, wording *NPs) {

View file

@ -209,7 +209,7 @@ void Sentences::VPs::switch_dl_mode(parse_node *PN, int sense) {
<debugging-log-request> ::=
everything | ==> { EVERYTHING_DLR, - }
nothing | ==> { NOTHING_DLR, - }
<preform-nonterminal> | ==> PREFORM_DLR; *XP = RP[1]
<preform-nonterminal> | ==> { PREFORM_DLR, RP[1] }
... ==> { SOMETHING_DLR, - }
=
@ -427,7 +427,7 @@ new action.
inform 6 ==> TRUE; *XP = NULL;
<translation-target-language> ::=
<natural-language> ==> TRUE; *XP = RP[1];
<natural-language> ==> { TRUE, RP[1] }
@ =
int Sentences::VPs::translates_into_unicode_as_SMF(int task, parse_node *V, wording *NPs) {

View file

@ -158,23 +158,23 @@ which might take forms such as:
=
<can-be-sentence-object> ::=
either <np-alternative-list> ( <condition-name> ) | ==> TRUE; *XP = RP[1]; ((parse_node *) RP[1])->next = RP[2];
<np-alternative-list> ( <condition-name> ) | ==> FALSE; *XP = RP[1]; ((parse_node *) RP[1])->next = RP[2];
either <np-alternative-list> | ==> TRUE; *XP = RP[1]
<np-alternative-list> ==> FALSE; *XP = RP[1]
either <np-alternative-list> ( <condition-name> ) | ==> { TRUE, RP[1] }; ((parse_node *) RP[1])->next = RP[2];
<np-alternative-list> ( <condition-name> ) | ==> { FALSE, RP[1] }; ((parse_node *) RP[1])->next = RP[2];
either <np-alternative-list> | ==> { TRUE, RP[1] }
<np-alternative-list> ==> { FALSE, RP[1] }
<condition-name> ::=
this is <condition-name-inner> | ==> 0; *XP = RP[1]
<condition-name-inner> ==> 0; *XP = RP[1]
this is <condition-name-inner> | ==> { 0, RP[1] }
<condition-name-inner> ==> { 0, RP[1] }
<condition-name-inner> ::=
<article> <condition-name-innermost> | ==> 0; *XP = RP[2]
<possessive-third-person> <condition-name-innermost> | ==> 0; *XP = RP[2]
<condition-name-innermost> ==> 0; *XP = RP[1]
<article> <condition-name-innermost> | ==> { 0, RP[2] }
<possessive-third-person> <condition-name-innermost> | ==> { 0, RP[2] }
<condition-name-innermost> ==> { 0, RP[1] }
<condition-name-innermost> ::=
<np-unparsed> property | ==> 0; *XP = RP[1]
<np-unparsed> ==> 0; *XP = RP[1]
<np-unparsed> property | ==> { 0, RP[1] }
<np-unparsed> ==> { 0, RP[1] }
@<An optional condition name can only be given to a condition@> =
if ((Wordings::nonempty(CNW)) && (count < 3)) {

View file

@ -392,7 +392,7 @@ property of something.
in the presence of ... | ==> { advance Wordings::delta(WR[1], W) }
... that varies | ==> { advance Wordings::delta(WR[1], W) }
... variable | ==> { advance Wordings::delta(WR[1], W) }
{<property-name-v>} of ... ==> 0; *XP = RP[1]
{<property-name-v>} of ... ==> { 0, RP[1] }
@<Act on a newly-discovered property of something@> =
property *prn = NULL;
@ -464,10 +464,10 @@ a noun instead of a condition testing the current action.
=
<assertion-np-as-value> ::=
variable | ==> @<Issue PM_VagueVariable problem@>
action of <s-explicit-action> | ==> TRUE; *XP = RP[1]
<s-descriptive-type-expression> | ==> TRUE; *XP = RP[1]
<s-global-variable> ==> TRUE; *XP = RP[1]
variable | ==> @<Issue PM_VagueVariable problem@>
action of <s-explicit-action> | ==> { TRUE, RP[1] }
<s-descriptive-type-expression> | ==> { TRUE, RP[1] }
<s-global-variable> ==> { TRUE, RP[1] }
@<Parse the noun phrase as a value@> =
if (<assertion-np-as-value>(Node::get_text(p))) {

View file

@ -330,7 +330,7 @@ int PL::EPSMap::index_map_with_SMF(int task, parse_node *V, wording *NPs) {
=
<direction-name> ::=
<instance-of-object> ==> 0; *XP = RP[1]; if (Instances::of_kind(RP[1], K_direction) == FALSE) return FALSE;
<instance-of-object> ==> { pass 1 }; if (Instances::of_kind(RP[1], K_direction) == FALSE) return FALSE;
@ The subject noun phrase of sentences like this:

View file

@ -366,15 +366,15 @@ The subject is simple: it has to be a scene name.
=
<scene-ends-sentence-subject> ::=
<scene-name> | ==> TRUE; *XP = RP[1]
... ==> @<Issue PM_ScenesOnly problem@>
<scene-name> | ==> { TRUE, RP[1] }
... ==> @<Issue PM_ScenesOnly problem@>
@<Issue PM_ScenesOnly problem@> =
*X = FALSE;
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_ScenesOnly),
"'begins when' and 'ends when' can only be applied to scenes",
"which have already been defined with a sentence like 'The final "
"confrontation is a scene.'");
==> { FALSE, NULL };
@ The adverb, if present, always matches, since the scene end is created
if it doesn't already exist:
@ -389,14 +389,14 @@ in a different context, for instance, and could still be valid in that case.
=
<scene-ends-sentence-object> ::=
<text-including-a-calling> | ==> @<Issue PM_ScenesDisallowCalled problem@>
play begins | ==> { -1, - }
play ends | ==> @<Issue PM_ScenesNotPlay problem@>
<scene-name> begins | ==> 0; <<scene:named>> = RP[1]
<scene-name> ends | ==> 1; <<scene:named>> = RP[1]
<scene-name> ends <scene-end-name> | ==> R[2]; <<scene:named>> = RP[1]
<scene-name> ends ... | ==> @<Issue PM_ScenesUnknownEnd problem@>
<s-condition> ==> -2; <<parse_node:cond>> = RP[1]
<text-including-a-calling> | ==> @<Issue PM_ScenesDisallowCalled problem@>
play begins | ==> { -1, - }
play ends | ==> @<Issue PM_ScenesNotPlay problem@>
<scene-name> begins | ==> 0; <<scene:named>> = RP[1]
<scene-name> ends | ==> 1; <<scene:named>> = RP[1]
<scene-name> ends <scene-end-name> | ==> R[2]; <<scene:named>> = RP[1]
<scene-name> ends ... | ==> @<Issue PM_ScenesUnknownEnd problem@>
<s-condition> ==> -2; <<parse_node:cond>> = RP[1]
@<Issue PM_ScenesDisallowCalled problem@> =
*X = -1;

View file

@ -415,15 +415,15 @@ an object" pseudo-value).
=
<spatial-specifying-nouns> ::=
_something/anything *** | ==> 0; <<kind:k>> = K_thing
_somewhere/anywhere *** | ==> 0; <<kind:k>> = K_room
_someone/anyone/somebody/anybody *** | ==> 0; <<kind:k>> = K_person
_everything *** | ==> 0; <<kind:k>> = K_thing; <<quantifier:q>> = for_all_quantifier
_everywhere *** | ==> 0; <<kind:k>> = K_room; <<quantifier:q>> = for_all_quantifier
_everyone/everybody *** | ==> 0; <<kind:k>> = K_person; <<quantifier:q>> = for_all_quantifier
_nowhere *** | ==> 0; <<kind:k>> = K_room; <<quantifier:q>> = not_exists_quantifier
_nobody/no-one *** | ==> 0; <<kind:k>> = K_person; <<quantifier:q>> = not_exists_quantifier
_no _one *** ==> 0; <<kind:k>> = K_person; <<quantifier:q>> = not_exists_quantifier
_something/anything *** | ==> { -, K_thing }
_somewhere/anywhere *** | ==> { -, K_room }
_someone/anyone/somebody/anybody *** | ==> { -, K_person }
_everything *** | ==> { -, K_thing, <<quantifier:q>> = for_all_quantifier }
_everywhere *** | ==> { -, K_room, <<quantifier:q>> = for_all_quantifier }
_everyone/everybody *** | ==> { -, K_person, <<quantifier:q>> = for_all_quantifier }
_nowhere *** | ==> { -, K_room, <<quantifier:q>> = not_exists_quantifier }
_nobody/no-one *** | ==> { -, K_person, <<quantifier:q>> = not_exists_quantifier }
_no _one *** ==> { -, K_person, <<quantifier:q>> = not_exists_quantifier }
@ Words like "something" or "everywhere" combine a common noun -- thing,
and implicitly room -- with a determiner -- one thing, all rooms. When we
@ -443,10 +443,10 @@ that such a door exists -- we needn't set the variable.
int PL::Spatial::spatial_parse_composite_NQs(wording *W, wording *DW,
quantifier **quant, kind **some_kind) {
if (K_thing) {
<<quantifier:q>> = NULL; <<kind:k>> = NULL;
<<quantifier:q>> = NULL;
if (<spatial-specifying-nouns>(*W)) {
*W = Wordings::from(*W, Wordings::first_wn(GET_RW(<spatial-specifying-nouns>, 1)));
*quant = <<quantifier:q>>; *some_kind = <<kind:k>>;
*quant = <<quantifier:q>>; *some_kind = <<rp>>;
return TRUE;
}
}

View file

@ -103,27 +103,26 @@ operands.
=
<action-list> ::=
doing something/anything other than <anl-excluded> | ==> FALSE; *XP = RP[1];
doing something/anything except <anl-excluded> | ==> FALSE; *XP = RP[1];
doing something/anything to/with <anl-to-tail> | ==> TRUE; *XP = RP[1];
doing something/anything | ==> @<Construct ANL for anything@>
doing something/anything ... | ==> { fail }
<anl> ==> TRUE; *XP = RP[1];
doing something/anything other than <anl-excluded> | ==> { FALSE, RP[1] }
doing something/anything except <anl-excluded> | ==> { FALSE, RP[1] }
doing something/anything to/with <anl-to-tail> | ==> { TRUE, RP[1] }
doing something/anything | ==> @<Construct ANL for anything@>
doing something/anything ... | ==> { fail }
<anl> ==> { TRUE, RP[1] }
<anl-excluded> ::=
<anl> to/with {<anl-minimal-common-operand>} | ==> @<Add to-clause to excluded ANL@>;
<anl> ==> TRUE; *XP = PL::Actions::Lists::flip_anl_parity(RP[1], FALSE);
<anl> to/with {<anl-minimal-common-operand>} | ==> @<Add to-clause to excluded ANL@>;
<anl> ==> { TRUE, PL::Actions::Lists::flip_anl_parity(RP[1], FALSE) }
<anl-minimal-common-operand> ::=
_,/or ... | ==> { fail }
... to/with ... | ==> { fail }
... ==> TRUE;
_,/or ... | ==> { fail }
... to/with ... | ==> { fail }
...
@<Construct ANL for anything@> =
*X = TRUE;
action_name_list *new_anl = PL::Actions::Lists::anl_new();
new_anl->word_position = Wordings::first_wn(W);
*XP = new_anl;
==> { TRUE, new_anl };
@ The trickiest form is:
@ -138,16 +137,16 @@ for instance, we don't want to count the "in" from "fixed in place".
=
<anl-to-tail> ::=
<anl-operand> <anl-in-tail> | ==> @<Augment ANL with in clause@>
<anl-operand> ==> 0; *XP = RP[1]
<anl-operand> <anl-in-tail> | ==> @<Augment ANL with in clause@>
<anl-operand> ==> { pass 1 }
<anl-operand> ::=
... ==> @<Construct ANL for anything applied@>
... ==> @<Construct ANL for anything applied@>
<anl-in-tail> ::=
fixed in place *** | ==> { advance Wordings::delta(WR[1], W) }
is/are/was/were/been/listed in *** | ==> { advance Wordings::delta(WR[1], W) }
in ... ==> { TRUE, - }
fixed in place *** | ==> { advance Wordings::delta(WR[1], W) }
is/are/was/were/been/listed in *** | ==> { advance Wordings::delta(WR[1], W) }
in ... ==> { TRUE, - }
@<Augment ANL with in clause@> =
action_name_list *anl = RP[1];
@ -169,12 +168,12 @@ for instance, we don't want to count the "in" from "fixed in place".
=
<anl> ::=
<anl-entry> <anl-tail> | ==> @<Join parsed ANLs@>
<anl-entry> ==> 0; *XP = RP[1];
<anl-entry> <anl-tail> | ==> @<Join parsed ANLs@>
<anl-entry> ==> { pass 1 }
<anl-tail> ::=
, _or <anl> | ==> 0; *XP = RP[1];
_,/or <anl> ==> 0; *XP = RP[1];
, _or <anl> | ==> { pass 1 }
_,/or <anl> ==> { pass 1 }
@ Which reduces us to an internal nonterminal for an entry in this list.
It actually produces multiple matches: for example,
@ -188,9 +187,9 @@ end, but it's syntactically valid.)
=
<anl-entry> ::=
<named-action-pattern> | ==> @<Make an action pattern from named behaviour@>
<named-action-pattern> <anl-in-tail> | ==> @<Make an action pattern from named behaviour plus in@>
<anl-entry-with-action> ==> 0; *XP = RP[1];
<named-action-pattern> | ==> @<Make an action pattern from named behaviour@>
<named-action-pattern> <anl-in-tail> | ==> @<Make an action pattern from named behaviour plus in@>
<anl-entry-with-action> ==> { pass 1 }
<named-action-pattern> internal {
named_action_pattern *nap = PL::Actions::Patterns::Named::by_name(W);

View file

@ -474,12 +474,12 @@ These are always present tense, and can't be negated.
=
<action-pattern> ::=
asking <action-parameter> to try <action-pattern-core> | ==> ACTOR_REQUESTED; *XP = RP[2]; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> trying <action-pattern-core> | ==> ACTOR_NAMED; *XP = RP[2]; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
<action-pattern-core-actor> ==> ACTOR_IMPLICITLY_PLAYER; *XP = RP[1];
asking <action-parameter> to try <action-pattern-core> | ==> { ACTOR_REQUESTED, RP[2] }; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> trying <action-pattern-core> | ==> { ACTOR_NAMED, RP[2] }; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
<action-pattern-core-actor> ==> { ACTOR_IMPLICITLY_PLAYER, RP[1] };
@ The second version is for contexts where the AP occurs as a condition: e.g.,
in a sentence like "if we have taken a jewel". Since these can occur in
@ -488,42 +488,42 @@ four combinations:
=
<we-are-action-pattern> ::=
we are asking <action-parameter> to try <action-pattern-core> | ==> ACTOR_REQUESTED; *XP = RP[2]; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
asking <action-parameter> to try <action-pattern-core> | ==> ACTOR_REQUESTED; *XP = RP[2]; ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> trying <action-pattern-core> | ==> ACTOR_NAMED; *XP = RP[2]; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
we are trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
we are <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
<action-pattern-core-actor> ==> ACTOR_IMPLICITLY_PLAYER; *XP = RP[1];
we are asking <action-parameter> to try <action-pattern-core> | ==> { ACTOR_REQUESTED, RP[2] }; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
asking <action-parameter> to try <action-pattern-core> | ==> { ACTOR_REQUESTED, RP[2] }; ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> trying <action-pattern-core> | ==> { ACTOR_NAMED, RP[2] }; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
we are trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
we are <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
<action-pattern-core-actor> ==> { ACTOR_IMPLICITLY_PLAYER, RP[1] };
<action-pattern-negated> ::=
we are not asking <action-parameter> to try <action-pattern-core> | ==> ACTOR_REQUESTED; *XP = RP[2]; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
not asking <action-parameter> to try <action-pattern-core> | ==> ACTOR_REQUESTED; *XP = RP[2]; ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> not trying <action-pattern-core> | ==> ACTOR_NAMED; *XP = RP[2]; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor not trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor not <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
we are not trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
not trying <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
we are not <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
not <action-pattern-core-actor> ==> ACTOR_IMPLICITLY_PLAYER; *XP = RP[1];
we are not asking <action-parameter> to try <action-pattern-core> | ==> { ACTOR_REQUESTED, RP[2] }; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
not asking <action-parameter> to try <action-pattern-core> | ==> { ACTOR_REQUESTED, RP[2] }; ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> not trying <action-pattern-core> | ==> { ACTOR_NAMED, RP[2] }; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor not trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor not <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
we are not trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
not trying <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
we are not <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
not <action-pattern-core-actor> ==> { ACTOR_IMPLICITLY_PLAYER, RP[1] };
<action-pattern-past> ::=
we have asked <action-parameter> to try <action-pattern-core> | ==> ACTOR_REQUESTED; *XP = RP[2]; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> has tried <action-pattern-core> | ==> ACTOR_NAMED; *XP = RP[2]; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor has tried <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor has <action-pattern-past-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
we have tried <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
we have <action-pattern-past-core> ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
we have asked <action-parameter> to try <action-pattern-core> | ==> { ACTOR_REQUESTED, RP[2] }; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> has tried <action-pattern-core> | ==> { ACTOR_NAMED, RP[2] }; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor has tried <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor has <action-pattern-past-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
we have tried <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
we have <action-pattern-past-core> ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
<action-pattern-past-negated> ::=
we have not asked <action-parameter> to try <action-pattern-core> | ==> ACTOR_REQUESTED; *XP = RP[2]; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> has not tried <action-pattern-core> | ==> ACTOR_NAMED; *XP = RP[2]; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor has not tried <action-pattern-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor has not <action-pattern-past-core> | ==> ACTOR_EXPLICITLY_UNIVERSAL; *XP = RP[1]; ap = *XP; ap->applies_to_any_actor = TRUE;
we have not tried <action-pattern-core> | ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
we have not <action-pattern-past-core> ==> ACTOR_EXPLICITLY_PLAYER; *XP = RP[1];
we have not asked <action-parameter> to try <action-pattern-core> | ==> { ACTOR_REQUESTED, RP[2] }; action_pattern *ap = *XP; ap->request = TRUE; ap->actor_spec = RP[1];
<action-parameter> has not tried <action-pattern-core> | ==> { ACTOR_NAMED, RP[2] }; ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
an actor has not tried <action-pattern-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
an actor has not <action-pattern-past-core> | ==> { ACTOR_EXPLICITLY_UNIVERSAL, RP[1] }; ap = *XP; ap->applies_to_any_actor = TRUE;
we have not tried <action-pattern-core> | ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
we have not <action-pattern-past-core> ==> { ACTOR_EXPLICITLY_PLAYER, RP[1] };
@ There is one more tweak at this top level. Inform allows an ambiguous but
shorter and more natural syntax in which the actor's name simply appears at
@ -539,8 +539,8 @@ actorless possibility can always be written.
=
<action-pattern-core-actor> ::=
<action-pattern-core> | ==> ACTOR_IMPLICITLY_PLAYER; *XP = RP[1];
<actor-description> <action-pattern-core> ==> ACTOR_NAMED; *XP = RP[2]; action_pattern *ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
<action-pattern-core> | ==> { ACTOR_IMPLICITLY_PLAYER, RP[1] };
<actor-description> <action-pattern-core> ==> { ACTOR_NAMED, RP[2] }; action_pattern *ap = *XP; ap->request = FALSE; ap->actor_spec = RP[1];
@ And this voracious token matches the actor's name as an initial excerpt,
which is much faster than exhaustive searching. It tries to break just before
@ -695,8 +695,8 @@ a condition attached with "when":
=
<ap-common-core> ::=
<ap-common-core-inner> when/while <condition-in-ap> | ==> 0; *XP = RP[1]; action_pattern *ap = *XP; ap->when = RP[2]; if (pap_failure_reason == MISC_PAPF) pap_failure_reason = WHENOKAY_PAPF;
<ap-common-core-inner> | ==> 0; *XP = RP[1];
<ap-common-core-inner> when/while <condition-in-ap> | ==> { 0, RP[1] }; action_pattern *ap = *XP; ap->when = RP[2]; if (pap_failure_reason == MISC_PAPF) pap_failure_reason = WHENOKAY_PAPF;
<ap-common-core-inner> | ==> { 0, RP[1] };
... when/while <condition-in-ap> | ==> 0; pap_failure_reason = WHENOKAY_PAPF; return FALSE; /* used only to diagnose problems */
... when/while ... ==> 0; if (pap_failure_reason != WHENOKAY_PAPF) pap_failure_reason = WHEN_PAPF; return FALSE; /* used only to diagnose problems */
@ -732,8 +732,8 @@ to enable Inform to set up a stack frame if there isn't one already, and so on.
=
<ap-common-core-inner> ::=
<ap-common-core-inner-inner> in the presence of <action-parameter> | ==> 0; *XP = RP[1]; action_pattern *ap = *XP; ap->presence_spec = RP[2];
<ap-common-core-inner-inner> ==> 0; *XP = RP[1];
<ap-common-core-inner-inner> in the presence of <action-parameter> | ==> { 0, RP[1] }; action_pattern *ap = *XP; ap->presence_spec = RP[2];
<ap-common-core-inner-inner> ==> { 0, RP[1] };
@ Level 5 now. The initial "in" clause, e.g., "in the Pantry", requires
special handling to prevent it from clashing with other interpretations of
@ -744,7 +744,7 @@ is valid as an AP, but this enables many natural-looking rules to be written
=
<ap-common-core-inner-inner> ::=
in <action-parameter> | ==> @<Make an actionless action pattern, specifying room only@>
<ap-common-core-inner-inner-inner> ==> 0; *XP = RP[1];
<ap-common-core-inner-inner-inner> ==> { 0, RP[1] };
@<Make an actionless action pattern, specifying room only@> =
if (Dash::validate_parameter(RP[1], K_object) == FALSE)
@ -796,7 +796,7 @@ We treat words like "something" specially to avoid them being read as
<action-operand> ::=
something/anything | ==> { FALSE, - }
something/anything else | ==> { FALSE, - }
<action-parameter> ==> TRUE; *XP = RP[1]
<action-parameter> ==> { TRUE, RP[1] }
<going-action-irregular-operand> ::=
nowhere | ==> { FALSE, - }
@ -813,9 +813,9 @@ here -- a constant, a description, a table entry, a variable, and so on.
<action-parameter> ::=
^<if-nonconstant-action-context> <s-local-variable> | ==> { fail }
^<if-nonconstant-action-context> <s-global-variable> | ==> { fail }
<s-local-variable> | ==> TRUE; *XP = RP[1]
<s-global-variable> | ==> TRUE; *XP = RP[1]
<s-type-expression-or-value> ==> TRUE; *XP = RP[1]
<s-local-variable> | ==> { TRUE, RP[1] }
<s-global-variable> | ==> { TRUE, RP[1] }
<s-type-expression-or-value> ==> { TRUE, RP[1] }
<if-nonconstant-action-context> internal 0 {
return permit_nonconstant_action_parameters;

View file

@ -712,7 +712,7 @@ void PL::Actions::compile_action_name_var_creators(void) {
<new-action-sentence-object-unarticled> ==> { pass 1 }
<new-action-sentence-object-unarticled> ::=
action <nounphrase-actionable> | ==> TRUE; *XP = RP[1]
action <nounphrase-actionable> | ==> { TRUE, RP[1] }
action ==> @<Issue PM_BadActionDeclaration problem@>
@<Issue PM_BadActionDeclaration problem@> =

View file

@ -227,7 +227,7 @@ kind *PL::Parsing::Tokens::kind_for_special_token(int gtc) {
anyone | ==> ANY_STUFF_GTC; <<parse_node:s>> = Specifications::from_kind(K_person);
anywhere | ==> ANY_STUFF_GTC; <<parse_node:s>> = Specifications::from_kind(K_room);
something related by reversed <relation-name> | ==> RELATED_GTC; *XP = BinaryPredicates::get_reversal(RP[1])
something related by <relation-name> | ==> RELATED_GTC; *XP = RP[1]
something related by <relation-name> | ==> { RELATED_GTC, RP[1] }
something related by ... | ==> @<Issue PM_GrammarBadRelation problem@>
<standard-grammar-token> | ==> R[1]
<definite-article> <k-kind> | ==> STUFF_GTC; <<parse_node:s>> = Specifications::from_kind(RP[2])

View file

@ -141,10 +141,10 @@ As examples:
=
<understand-sentence-subject> ::=
nothing | ==> NOTHING_UNDERSTAND_FORM; *XP = NULL
<understand-property-list> | ==> PROPERTY_UNDERSTAND_FORM; *XP = RP[1]
the command/commands <understand-regular-list> | ==> COMMAND_UNDERSTAND_FORM; *XP = RP[1]
<understand-property-list> | ==> { PROPERTY_UNDERSTAND_FORM, RP[1] }
the command/commands <understand-regular-list> | ==> { COMMAND_UNDERSTAND_FORM, RP[1] }
the verb/verbs ... | ==> @<Issue PM_OldVerbUsage problem@>
<understand-regular-list> ==> GRAMMAR_UNDERSTAND_FORM; *XP = RP[1]
<understand-regular-list> ==> { GRAMMAR_UNDERSTAND_FORM, RP[1] }
@<Issue PM_OldVerbUsage problem@> =
*X = NO_UNDERSTAND_FORM;
@ -162,11 +162,11 @@ As examples:
<understand-regular-list> ::=
... | ==> 0; *XP = NULL; return preform_lookahead_mode; /* match only when looking ahead */
<understand-regular-entry> <understand-regular-tail> | ==> @<Compose understand item list@>
<understand-regular-entry> ==> 0; *XP = RP[1];
<understand-regular-entry> ==> { 0, RP[1] };
<understand-regular-tail> ::=
, _and/or <understand-regular-list> | ==> 0; *XP = RP[1];
_,/and/or <understand-regular-list> ==> 0; *XP = RP[1];
, _and/or <understand-regular-list> | ==> { 0, RP[1] };
_,/and/or <understand-regular-list> ==> { 0, RP[1] };
<understand-regular-entry> ::=
... ==> @<Make understand item@>
@ -178,11 +178,11 @@ formal way (with "property").
<understand-property-list> ::=
... | ==> 0; *XP = NULL; return preform_lookahead_mode; /* match only when looking ahead */
<understand-property-entry> <understand-property-tail> | ==> @<Compose understand item list@>
<understand-property-entry> ==> 0; *XP = RP[1];
<understand-property-entry> ==> { 0, RP[1] };
<understand-property-tail> ::=
, _and/or <understand-property-list> | ==> 0; *XP = RP[1];
_,/and/or <understand-property-list> ==> 0; *XP = RP[1];
, _and/or <understand-property-list> | ==> { 0, RP[1] };
_,/and/or <understand-property-list> ==> { 0, RP[1] };
<understand-property-entry> ::=
<property-name> property | ==> @<Make understand property item@>
@ -239,17 +239,17 @@ It's not widely known, but the object phrase here can be a list.
=
<understand-sentence-object> ::=
<understand-sentence-object-uncond> when/while ... | ==> 2; *XP = RP[1]
<understand-sentence-object-uncond> ==> 1; *XP = RP[1]
<understand-sentence-object-uncond> when/while ... | ==> { 2, RP[1] }
<understand-sentence-object-uncond> ==> { 1, RP[1] }
<understand-sentence-object-uncond> ::=
... | ==> 0; return preform_lookahead_mode; /* match only when looking ahead */
<understand-sentence-entry> <understand-sentence-object-tail> | ==> @<Compose understand reference list@>
<understand-sentence-entry> ==> 0; *XP = RP[1]
<understand-sentence-entry> ==> { 0, RP[1] }
<understand-sentence-object-tail> ::=
, _and/or <understand-sentence-object-uncond> | ==> 0; *XP = RP[1]
_,/and/or <understand-sentence-object-uncond> ==> 0; *XP = RP[1]
, _and/or <understand-sentence-object-uncond> | ==> { 0, RP[1] }
_,/and/or <understand-sentence-object-uncond> ==> { 0, RP[1] }
<understand-sentence-entry> ::=
<understand-as-this> ==> 0; if (!preform_lookahead_mode) @<Deal with UT vars@>;
@ -375,12 +375,12 @@ to or described can be of any kind, but in fact we restrict to kinds of object.
=
<understand-property-sentence-object> ::=
<understand-property-sentence-object-unconditional> when/while ... | ==> 2; *XP = RP[1]; <<level>> = R[1]
<understand-property-sentence-object-unconditional> ==> 1; *XP = RP[1]; <<level>> = R[1]
<understand-property-sentence-object-unconditional> when/while ... | ==> { 2, RP[1] }; <<level>> = R[1]
<understand-property-sentence-object-unconditional> ==> { 1, RP[1] }; <<level>> = R[1]
<understand-property-sentence-object-unconditional> ::=
referring to <understand-property-reference> | ==> 1; *XP = RP[1]
describing <understand-property-reference> | ==> 2; *XP = RP[1]
referring to <understand-property-reference> | ==> { 1, RP[1] }
describing <understand-property-reference> | ==> { 2, RP[1] }
... ==> @<Issue PM_BadUnderstandProperty problem@>
<understand-property-reference> ::=

View file

@ -162,7 +162,7 @@ to other natural languages.
... -- <documentation-symbol> -- ==> { pass 1 }
<documentation-symbol> ::=
documented at ### ==> Wordings::first_wn(WR[1])
documented at ### ==> { Wordings::first_wn(WR[1]), - }
@ =
wording Index::DocReferences::position_of_symbol(wording *W) {

View file

@ -66,42 +66,42 @@ phrase tokens.
=
<k-kind-as-name-token> ::=
( <k-kind-as-name-token> ) | ==> { pass 1 }
name of kind of <k-kind-abbreviating> | ==> { pass 1 }
name of kind <k-kind-abbreviating> | ==> { pass 1 }
name of kind of ... | ==> { -, NULL }
name of kind ... ==> { -, NULL }
( <k-kind-as-name-token> ) | ==> { pass 1 }
name of kind of <k-kind-abbreviating> | ==> { pass 1 }
name of kind <k-kind-abbreviating> | ==> { pass 1 }
name of kind of ... | ==> { -, NULL }
name of kind ... ==> { -, NULL }
<k-kind-abbreviating> ::=
( <k-kind-abbreviating> ) | ==> { pass 1 }
<k-kind-of-kind> <k-formal-kind-variable> | ==> Kinds::variable_construction(R[2], RP[1])
<k-kind> ==> { pass 1 }
( <k-kind-abbreviating> ) | ==> { pass 1 }
<k-kind-of-kind> <k-formal-kind-variable> | ==> { -, Kinds::variable_construction(R[2], RP[1]) }
<k-kind> ==> { pass 1 }
@ So now we can begin properly. Every valid kind matches <k-kind>:
=
<k-kind> ::=
( <k-kind> ) | ==> { pass 1 }
^<if-parsing-phrase-tokens> <k-kind-variable> | ==> { pass 2 }
<if-parsing-phrase-tokens> <k-variable-definition> | ==> { pass 2 }
<k-base-kind> | ==> { pass 1 }
<k-irregular-kind-construction> | ==> { pass 1 }
<k-kind-construction> ==> { pass 1 }
( <k-kind> ) | ==> { pass 1 }
^<if-parsing-phrase-tokens> <k-kind-variable> | ==> { pass 2 }
<if-parsing-phrase-tokens> <k-variable-definition> | ==> { pass 2 }
<k-base-kind> | ==> { pass 1 }
<k-irregular-kind-construction> | ==> { pass 1 }
<k-kind-construction> ==> { pass 1 }
@ And, as a convenient shorthand:
=
<k-kind-articled> ::=
<indefinite-article> <k-kind> | ==> { pass 2 }
<k-kind> ==> { pass 1 }
<indefinite-article> <k-kind> | ==> { pass 2 }
<k-kind> ==> { pass 1 }
@ In phrase-token mode, kind variables are treated as formal symbols, not as
the kinds which are their current values:
=
<k-variable-definition> ::=
<k-formal-kind-variable> | ==> { pass 1 }
<k-kind-of-kind> of kind <k-formal-kind-variable> ==> Kinds::variable_construction(R[2], RP[1])
<k-formal-kind-variable> | ==> { pass 1 }
<k-kind-of-kind> of kind <k-formal-kind-variable> ==> { -, Kinds::variable_construction(R[2], RP[1]) }
@ Some base kinds with one-word names have that word flagged with a direct
pointer to the kind, for speed of parsing. Names of base kinds, such as
@ -157,20 +157,31 @@ And similarly for the others here, except "either/or property", which is a
=
<k-irregular-kind-construction> ::=
indexed text | ==> K_text
indexed texts | ==> K_text
stored action | ==> K_stored_action; if (K_stored_action == NULL) return FALSE;
stored actions | ==> K_stored_action; if (K_stored_action == NULL) return FALSE;
object-based rulebook producing <indefinite-article> <k-kind> | ==> Kinds::binary_construction(CON_rulebook, K_object, RP[2])
object-based rulebook producing <k-kind> | ==> Kinds::binary_construction(CON_rulebook, K_object, RP[1])
object-based rulebook | ==> Kinds::binary_construction(CON_rulebook, K_object, K_nil)
action-based rulebook | ==> Kinds::binary_construction(CON_rulebook, K_action_name, K_nil); if (K_action_name == NULL) return FALSE;
object-based rule producing <indefinite-article> <k-kind> | ==> Kinds::binary_construction(CON_rule, K_object, RP[2])
object-based rule producing <k-kind> | ==> Kinds::binary_construction(CON_rule, K_object, RP[1])
object-based rule | ==> Kinds::binary_construction(CON_rule, K_object, K_nil)
action-based rule | ==> Kinds::binary_construction(CON_rule, K_action_name, K_nil); if (K_action_name == NULL) return FALSE;
either-or property ==> Kinds::unary_construction(CON_property, K_truth_state)
indexed text | ==> { -, K_text }
indexed texts | ==> { -, K_text }
stored action | ==> @<Stored action if it exists@>
stored actions | ==> @<Stored action if it exists@>
object-based rulebook producing <indefinite-article> <k-kind> | ==> { -, Kinds::binary_construction(CON_rulebook, K_object, RP[2]) }
object-based rulebook producing <k-kind> | ==> { -, Kinds::binary_construction(CON_rulebook, K_object, RP[1]) }
object-based rulebook | ==> { -, Kinds::binary_construction(CON_rulebook, K_object, K_nil) }
action-based rulebook | ==> @<Action rulebook if it exists@>
object-based rule producing <indefinite-article> <k-kind> | ==> { -, Kinds::binary_construction(CON_rule, K_object, RP[2]) }
object-based rule producing <k-kind> | ==> { -, Kinds::binary_construction(CON_rule, K_object, RP[1]) }
object-based rule | ==> { -, Kinds::binary_construction(CON_rule, K_object, K_nil) }
action-based rule | ==> @<Action rule if it exists@>
either-or property ==> { -, Kinds::unary_construction(CON_property, K_truth_state) }
@<Stored action if it exists@> =
if (K_stored_action == NULL) { ==> { fail production }; }
==> { -, K_stored_action };
@<Action rulebook if it exists@> =
if (K_action_name == NULL) { ==> { fail production }; }
==> { -, Kinds::binary_construction(CON_rulebook, K_action_name, K_nil) };
@<Action rule if it exists@> =
if (K_action_name == NULL) { ==> { fail production }; }
==> { -, Kinds::binary_construction(CON_rule, K_action_name, K_nil) };
@ This loop looks a little slow, but there are only about 10 proper constructors.
@ -242,25 +253,25 @@ be more varied.
=
<k-single-material> ::=
( <k-single-material> ) | ==> { pass 1 }
( <k-single-material> ) | ==> { pass 1 }
<article> <k-single-material> | ==> { pass 2 }
<k-kind> ==> { pass 1 }
<k-kind> ==> { pass 1 }
<k-optional-material> ::=
( <k-optional-material> ) | ==> { pass 1 }
<article> <k-optional-material> | ==> { pass 2 }
nothing | ==> K_nil
action | ==> K_action_name
<k-kind> ==> { pass 1 }
( <k-optional-material> ) | ==> { pass 1 }
<article> <k-optional-material> | ==> { pass 2 }
nothing | ==> { -, K_nil }
action | ==> { -, K_action_name }
<k-kind> ==> { pass 1 }
<k-tupled-material> ::=
( <k-tuple-list> ) | ==> { pass 1 }
nothing | ==> K_nil
<k-single-material> ==> Kinds::binary_construction(CON_TUPLE_ENTRY, RP[1], K_nil)
( <k-tuple-list> ) | ==> { pass 1 }
nothing | ==> { -, K_nil }
<k-single-material> ==> { -, Kinds::binary_construction(CON_TUPLE_ENTRY, RP[1], K_nil) }
<k-tuple-list> ::=
<k-single-material> , <k-tuple-list> | ==> Kinds::binary_construction(CON_TUPLE_ENTRY, RP[1], RP[2])
<k-single-material> ==> Kinds::binary_construction(CON_TUPLE_ENTRY, RP[1], K_nil)
<k-single-material> , <k-tuple-list> | ==> { -, Kinds::binary_construction(CON_TUPLE_ENTRY, RP[1], RP[2]) }
<k-single-material> ==> { -, Kinds::binary_construction(CON_TUPLE_ENTRY, RP[1], K_nil) }
@ The following looks at a word range and tries to find text making a kind
construction: if it does, it adjusts the word ranges to the kind(s) being
@ -341,7 +352,7 @@ or "list of texts" will fail.
=
<k-kind-of-kind> ::=
<k-kind> ==> RP[1]; if (Kinds::Behaviour::is_kind_of_kind(RP[1]) == FALSE) return FALSE;
<k-kind> ==> { pass 1 }; if (Kinds::Behaviour::is_kind_of_kind(RP[1]) == FALSE) return FALSE;
@h Parsing kind variables.
As a small detour, here's how we deal with the pleasingly simple names A to Z

View file

@ -127,7 +127,7 @@ letters or digits, with the first being a letter.
<new-file-sentence-object-unarticled> ==> { pass 1 }
<new-file-sentence-object-unarticled> ::=
called <np-unparsed> ==> TRUE; *XP = RP[1];
called <np-unparsed> ==> { TRUE, RP[1] }
@ =
int PL::Files::new_file_SMF(int task, parse_node *V, wording *NPs) {

View file

@ -80,7 +80,7 @@ blorb_figure *PL::Figures::new_blorb_figure(instance *nc) {
<new-figure-sentence-object-unarticled> ==> { pass 1 }
<new-figure-sentence-object-unarticled> ::=
file <np-unparsed> ==> TRUE; *XP = RP[1]
file <np-unparsed> ==> { TRUE, RP[1] }
@ =
int PL::Figures::new_figure_SMF(int task, parse_node *V, wording *NPs) {

View file

@ -72,7 +72,7 @@ blorb_sound *PL::Sounds::new_blorb_sound(instance *nc) {
<new-sound-sentence-object-unarticled> ==> { pass 1 }
<new-sound-sentence-object-unarticled> ::=
file <np-unparsed> ==> TRUE; *XP = RP[1]
file <np-unparsed> ==> { TRUE, RP[1] }
@ =
int PL::Sounds::new_sound_SMF(int task, parse_node *V, wording *NPs) {

View file

@ -32,14 +32,14 @@ void Unit::test_lexer(text_stream *arg) {
=
<text> ::=
invade ... | ==> TRUE; PRINT("Invading %+W\n", GET_RW(<text>, 1));
proclaim <any-integer> | ==> TRUE; PRINT("It is now %d.\n", R[1]);
announce <quoted-text> | ==> TRUE; PRINT("Attention: %w.\n", Lexer::word_text(R[1]));
<declaration> | ==> TRUE; PRINT("Dominion %d now independent\n", R[1]);
... ==> FALSE; PRINT("Unknown command\n");
invade ... | ==> { TRUE, - }; PRINT("Invading %+W\n", GET_RW(<text>, 1));
proclaim <any-integer> | ==> { TRUE, - }; PRINT("It is now %d.\n", R[1]);
announce <quoted-text> | ==> { TRUE, - }; PRINT("Attention: %w.\n", Lexer::word_text(R[1]));
<declaration> | ==> { TRUE, - }; PRINT("Dominion %d now independent\n", R[1]);
... ==> { FALSE, - }; PRINT("Unknown command\n");
<declaration> ::=
declare <dominion> independent ==> R[1]
declare <dominion> independent ==> { pass 1 }
<dominion> ::=
canada |