[plt-scheme] Parser tools and actions in mid-rules

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Thu Mar 19 12:26:26 EDT 2009

Hi all,

Bison supports actions in mid-rule:
http://www.gnu.org/software/bison/manual/html_mono/bison.html#Mid_002dRule-Actions
however this doesn't seem the case with Parser Tools.

I wonder then, what's the best way to solve the following issue:
I am parsing a formal specification language which introduce several
environments which are just pairs of Variable / Type.
One structure of the language is an Event which has a local variables
section and a body section.
Something like:
event ::= EVENT locals BODY expression END;

The way to do this would be to have a mid-rule after locals to create
a new environment which contains the variables defined in locals and
then after END, we remove the destroy the environment.

Without mid-rules I am a bit lost. Is there any other way to do this
kind of thing? (or maybe some way to turn an unambiguous grammar with
mid-rules into an unambiguous grammar without mid-rules)

-- 
Paulo Jorge Matos - pocmatos at gmail.com
Webpage: http://www.personal.soton.ac.uk/pocm


Posted on the users mailing list.