Action type inference

Last time I showed you the code:

params_ -> (COMMA- 
            p:param ~ <RichStr>{ new RichStr(p)})*
           { new Parameters(currCoords(),p) };

It’s no-brainer I didn’t like it very much because the type of the projection is too obvious. As the matter of fact the type of main action is also obvious.

At least I could add simple type inference — when the action starts with constructor call, extract the type name — so I did. It is enough to write:

params_ -> (COMMA- 
            p:param ~ { new RichStr(p)})*
           { new Parameters(currCoords(),p) };

and the types for “param” and “params_” will be inferred by NLT.

More features didn’t make this release because NLT code was plagued with bugs and annoyances — black Friday one could say. The most embarrassing showed up on LALR and forking LALR parser comparison. As it turned out when executing user actions in forking parser I didn’t check if there are any syntax errors, only if there are action errors.

Well, actually there is one more feature added — reducing number of productions in generated grammar. But since I don’t have plenty of use cases at hand I decided to play safely and disabled it. The code is in the uploaded solution so it is enough to uncomment one line to activate it.

Advertisement
Tagged ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: