k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: Traian Florin Șerbănuță <traian.serbanuta AT info.uaic.ro>
- To: Ulrich Kühne <ulrichk AT informatik.uni-bremen.de>
- Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
- Subject: Re: [K-user] language with goto
- Date: Tue, 26 Mar 2013 17:03:28 +0200
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
Hi Ulrich,
Although we used to allow different kinds of strictness for different
kind of computation (cells), this hasn't been maintained in the latest
version of K, so strict only means strict in the <k> cell.
Nevertheless, one thing you can do would be to use the <k> cell for
both parsing and execution, and guard the parsing rules by always
mentioning the state cell, though this would mean some redundancy.
Another alternative would be to use the <cxt> cell for parsing (i.e.,
put the PGM in that cell to begin with), since you don't seem to need
any special features for that, and change the state from parsing to
running once the cxt cell becomes empty.
Hope this helps,
Traian
2013/3/26 Ulrich Kühne
<ulrichk AT informatik.uni-bremen.de>:
> Hi,
>
> I am trying to define an imperative language with goto. My idea is to have a
> first "parsing phase", where I put all the statements into a list and add an
> index to each statement. Only after this, I "load" one statement at a time
> into the execution context, indexed by a <pc> program counter.
>
> The problem is that the execution / evaluation gets stuck. I guess I need
> some heating rules, but I don't know how to write them. Obviously, I don't
> want the statements to be executed during the parsing phase, but only after
> loading them, so I cannot use a standard sequential heating like S:Stmt S2
> => S ~> S2.
>
> Does anyone have a good idea how to make this work? I attached the
> definition and an example. The execution yields this:
>
> sputnik$ krun test.goto
> <T>
> <k>
> .K
> </k>
> <pc>
> 3
> </pc>
> <ctx>
> z = (7 + 8) <===== GETTING STUCK!
> </ctx>
> <state>
> RUNNING
> </state>
> <rom>
> ListItem([ 0 , (x = 5) ])
> ListItem([ 1 , (y = 6) ])
> ListItem([ 2 , (z = (7 + 8)) ])
> ListItem([ 3 , (u = (x + 1)) ])
> ListItem([ 4 , (if (u == (x + 2)) then (v = 0) else (v = (x + 1)))
> ])
> ListItem([ 5 , (w = 42) ])
> </rom>
> <store>
> x |-> 5
> y |-> 6
> </store>
> </T>
>
>
> Thanks for your help
> Ulrich
>
>
> _______________________________________________
> k-user mailing list
> k-user AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/k-user
>
- [K-user] language with goto, Ulrich Kühne, 03/26/2013
- Re: [K-user] language with goto, Traian Florin Șerbănuță, 03/26/2013
- Re: [K-user] language with goto, Ulrich Kühne, 03/26/2013
- Re: [K-user] language with goto, Traian Florin Șerbănuță, 03/26/2013
Archive powered by MHonArc 2.6.16.