The "Rewrite The Parser in Inform 7" Project

I just stumbled into it.

Interestingly, I can’t get the ‘You can’t begin with a comma’ message by beginning a command with a comma (in the ordinary parser or in yours).

Both bugs found & fixed. Re-download version 7.

It is true the can’t begin with a comma error cannot be elicited from the standard parser, but it can in the above. I took some pains to restore it. (Well, they weren’t very big pains.)

The above two bugs were both from the same spot as the 2nd-to-last bug I fixed, in which I had coded something regarding “the chosen (position)” instead of “where that word was found”, an error about as silly as having the wrong indentation.

But the infinite loop was fair. The phrase, “if the ‘comma’ is listed in the player’s parsed command”, in the original code actually has side effects: it leaves the parser’s current word position advanced down the command a ways. I coded the if-condition “correctly”, without that side effect, because asking the question shouldn’t change the answer. Mea culpa.

To fix it without breaking readability, I made a new global, “where the comma was found”, and check it explicitly in the same if-condition. If nothing else, that new global could be very useful to game or extension authors.

Thanks again for the detective work, Matt.

That does sound useful. I’m also interested to look into your other values like “where that word was found” - I was looking for something like that in another project I was working on.

This is indeed really great syntax.

Do you mind if I fold it into my next release of my port of Crowther’s Advent to I7 (crediting you, of course)? I made a few additions to allow adverbs to reflect past-tense conditions as well as present/future tense ones.

[code]Chapter 1 - Truth States as ‘We’ Commands (adapted from “The Parser” by Ron Newcomb)

[ It’s always difficult to name truth states because nothing reads naturally other than a letter: if x is true. These phrases allow us to name a truth state after an imperative sentence, and the optional adverbs allow us to imply how the variable is being used. ]
To decide if we still/should/need/must/have/-- (bool - a truth state): (- ({bool}) -).
To decide if we can’t/shouldn’t/haven’t (bool - a truth state): (- (({bool})) -).
To decide if we do/can/have not (bool - a truth state): (- (
({bool})) -).
To we will/should/just/now/still/may/must/have (bool - a truth state) again/–: (- {bool} = true; -);
To we no/do longer/not have/-- (bool - a truth state): (- {bool} = false; -).
To we needn’t/shouldn’t/won’t/haven’t (bool - a truth state): (- {bool} = false; -).
To we will/should/may/must (bool - a truth state) if (c - a condition): (- {bool} = ({c}); -);[/code]

Thanks Chris. Have at it.

Just a word of warning - when I tried to create my own phrases based on this technique, some of them (using forms of the verb “to be” and “to have”) caused namespace clashes that broke existing relations syntax. I had to prune a little bit.

Is anyone doing any more work with this?

In my upgrades to ATTACK I moved the parser rules into a Running the parser activity, and thought it would be good if we could make parsers just plug and play. You could have the traditional parser, or this one, or Interactive Parsing, and then extensions like the Smarter Parser could help them all. So I’m keen to help move this into a production-ready extension.

I don’t know about Ron, but I’ve been waiting to see what changes in the next I7 release. But I’ve been away for a while - did I miss the I7 release?

No, 6G60 is still the latest official release.

Sorry for the slow reply; I just moved a few days ago.

I still have some documentation to do on this. I can put up what I have so far in a couple of days if you’re interested. My life should settle down again in a couple of weeks.

The documentation only covers the three largest functions in the code. I didn’t feel the need to cover the small ones.

After a final 10-hour push which ended on the wrong side of the midnight hour last night, I’m proud (relieved) to say that the extension “Original Parser” has been submitted to the Inform extensions site. Thanks to everyone for the continued interest and support in this not-so-fun endeavor!

Hero!

Woohoo!

This is awesome.

Hooray!

I’m more interested to know what our resident Inform 7 developers think of this. Worth having it integrated into a future release?

They seem to have their hands full with the upcoming release…

Congratulations!

I think this will prove indispensable for producing an alternative more flexible parser that would be worthy of inclusion.

Thanks everyone.

Mark’s now posted it to Inform7.com

This is an amazing accomplishment.

David C.
www.textfyre.com