Parsing LANG1

In this section we will investigate the parsing of LANG1, that is, we will construct a function  that will go from the concrete syntax of LANG1 to the abstract syntax of LANG1.   Loosely speaking, this function, call it doparse,  will be an inverse to the function given by the homomorphism   hsyn = aitch(alg_LANG1Syn, __ ) .   However, since the context-free grammar for LANG1 is ambiguous  (i.e.,  hsyn is not injective),  what we will get is hsyndoparse  =  1  but  doparsehsyn  1.   The ambiguity is not be a problem since we will get hsem doparsehsyn=   hsem ,  where  hsem  = aitch(alg_LANG1Sem, __ )
It follows then that the function    hsem doparse  is a compiler for LANG1, that is, it is a function taking expressions written in the concrete syntax to their meanings.
 

The Programs

We offer the user three programs
  There is a built-in sample state, called samplestt,  with initial value  [["a", 10], ["b", 3], ["c", 77]] that can be used to test the following examples. Note that performing the examples will modify the value of samplestt.  Of course, you can also input states of  your own choosing.

Here are some sample concrete LANG1 programs  which you can parse, compile or run: