Skip to Content.
Sympa Menu

k-user - Re: [K-user] Printing

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] Printing


Chronological Thread 
  • From: Radu Mereuta <headness13 AT gmail.com>
  • To: Brandon Hill <bgh.list.reader AT gmail.com>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] Printing
  • Date: Fri, 28 Sep 2012 00:59:02 +0300
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

The error message is not really nice because that is a crash. Please make sure you are using the latest version (either take it from the svn, or take it from https://fmse.info.uaic.ro/imgs/releases/ ). Then submit an issue with the EXACT input that causes the problem. I tried the example above and it works on my computer.

Radu

On Fri, Sep 28, 2012 at 12:47 AM, Brandon Hill <bgh.list.reader AT gmail.com> wrote:
Thank you for the pointer on the better rules.  I thought I had tried
something like that and got errors, but it seems to work currently.

The cleaner rules don't seem to solve the printing issue, even when I
change the sort to I:Int and eliminate the side rule.  I was going
with V because it will contain more sorts in the future, but making
different rules for each result sort will be fine if that can be made
to work.

Thanks,
Brandon

On Thu, Sep 27, 2012 at 2:25 PM, Rosu, Grigore <grosu AT illinois.edu> wrote:
> Did you try I:Int instead of V:Val and remove the side condition?
>
> Grigore
>
>
>
> ________________________________________
> From: k-user-bounces AT cs.uiuc.edu [k-user-bounces AT cs.uiuc.edu] on behalf of Brandon Hill [bgh.list.reader AT gmail.com]
> Sent: Thursday, September 27, 2012 4:09 PM
> To: k-user AT cs.uiuc.edu
> Subject: [K-user] Printing
>
> I am trying to model a language that prints the resulting value from
> each _expression_.  The examples show how to explicitly print with an
> explicit print function, a Printable sort, and an output list.  I'm
> not entirely clear how that Printable works.
>
> Without it, I get:
>
> [Fatal Error] :1:1: Premature end of file.
> Error: Error while reading XML:Premature end of file.
>
> or
>
> (#ostream( 1 ))  (#buffer( (.) ))
>
> as output.  Here is a trimmed down version of what I tried:
>
>
> module RT-SYNTAX
>   imports BUILTIN-SYNTAX-HOOKS
>
>   syntax Val ::= Int
>
>   syntax Expr ::= Id | Val
>         > Id "<-" Expr  [right, strict(2)]
>
>   syntax Stmt ::= Expr ";" [strict]
>         | Stmt Stmt    [left]
>
>   syntax Pgm ::= Stmt
>
> endmodule
>
> module RT
>   imports RT-SYNTAX
>
>   syntax Val ::= "void"
>
>   syntax KResult ::= Val
>
>   configuration <T color="yellow">
>                   <k color="green"> $PGM:Pgm </k>
>                   <env color="LightSkyBlue"> .Map </env>
>                   <heap color="white"> .Map </heap>
>                   <nextLoc color="gray"> 0 </nextLoc>
>                   <out color="Orchid" stream="stdout"> .List </out>
>                 </T>
>
>   rule [declaration]:
>        <k> X:Id <- V:Val => void ...</k>
>        <env>... Rho => Rho[L/X] ...</env>
>        <heap>... . => L |-> V ...</heap>
>        <nextLoc> L => L +Int 1 </nextLoc>
>        when notBool(X in keys(Rho)) [transition]
>
>   rule [lookup]: <k> X => V ...</k>
>        <env>... X |-> L ...</env>
>        <heap>... L |-> V ...</heap> [supercool, transition]
>
>   rule [sequential]: (S1:Stmt S2:Stmt) => (S1 ~> S2)  [structural]
>
>   rule <k> (V:Val; ~> K:K) => K ...</k>
>        <out>... . => ListItem(V) </out>
>        when  V =/=K void
>
>   rule <k> (void; ~> K:K) => K ...</k>
>
> endmodule
>
>
> I also tried ListItem(Int2String(V)) but that doesn't work either.
>
> Any pointers would be appreciated.
>
> Thank you,
> Brandon
> _______________________________________________
> k-user mailing list
> k-user AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/k-user
_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user




Archive powered by MHonArc 2.6.16.

Top of Page