The minimal example of this bug in the 10.1.2 compiler appears to be
Understand “<any text>” as <a valid action name taking a noun> <any object>
Lab is a room.
Understand "xyzzy" as examining Lab.
Rather than failing the compiler, this should give the following error message:
Problem. You wrote ‘Understand “xyzzy” as examining the Lab’ but ‘understand … as …’ should be followed by a meaning, which might be an action (e.g., ‘understand “take [something]” as taking’), a thing (‘understand “stove” as the oven’) or more generally a value (‘understand “huitante” as 80’), or a named token for use in further grammar (‘understand “near [something]” as “[location phrase]”’). Also, the meaning needs to be precise, so ‘understand “x” as a number’ is not allowed - it does not say which number.
See the manual: 17.1 > 17.1. Understand
… and this is what happens if compiling for Ver 9.3/6M62, or if you substitute something other than <an object> after the action name in Ver 10.1.2, (or the name of an action that takes no noun, such as ‘jumping’).
To be specific, the correct syntax here is
Understand “<any text>” as <a valid action name>
and ‘looking under mat’ is not a valid action name- ‘looking under’ is the action name, we can’t specify exactly what the thing to be looked under is in the ‘as …ing’ clause of the declaration. We must do it in the first part, like this:
Understand "move [mat]" as looking under.
by creating a noun token [mat] that will match the mat object and only the mat object (by the name ‘mat’ or any other name we choose to give it*).
This Understand phrase adds a line to the grammar of ‘move’ that will match only with the mat and nothing else, producing a ‘looking under’ action on the mat.
You can see this by typing the debugging command ‘showverb move’, which gives the following output:
You can see a mat here.
Verb ‘clear’ ‘move’ ‘press’ ‘push’ ‘shift’
* noun=Routine(220967) → LookUnder
* noun → Push
* noun noun=Routine(220843) → PushDir
* noun ‘to’ noun=Routine(220880) → PushDir
Routine(220967) is the I6 representation of the [mat] token we created, the * means ‘any of the command verbs listed above’
so, to translate the first line of our new grammar for ‘move’
'match any of these command verbs followed by a name that matches the mat, to produce a ‘looking under’ action with the mat as the noun.
By which we can see that typing ‘clear mat’ or ‘push mat’ or ‘shift mat’ or ‘press mat’ will all also produce the action ‘looking under the mat’.
Also, if we type ‘move <anything other than the mat>’ the first line of grammar won’t match, and the parser will go on to try all the usual meanings of ‘move’ below it, starting with ‘pushing’.
Having said all that, restricting what can be matched by the parser like this is generally not a good idea, as you have little control over the responses to inputs that don’t work, since these are generated by the parser itself. Better to allow the parser to match a wide range of inputs, generate an action, then trap the one(s) you are interested in in Before or Instead rules:
Before pushing the mat: try looking under the mat instead.
will do what you originally intended in the simplest way.
NB here we can write ‘pushing the mat’, specifying the noun, because in the preamble to a Before rule we can use a full action pattern, which might be as complex as ‘pushing the mat in the Lab when the moon is full for the third time’ not simply an action name (which would have to be be plain ‘pushing’)
* e.g. by
Understand "rug" or "Oriental carpet" as the mat.