Skip to Content.
Sympa Menu

k-user - Re: [K-user] K input?

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] K input?


Chronological Thread 
  • From: Traian Florin Șerbănuță <traian.serbanuta AT info.uaic.ro>
  • To: Stefan Ciobaca <stefan.ciobaca AT gmail.com>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] K input?
  • Date: Wed, 17 Jul 2013 17:31:52 +0300
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

Although Stefan is basically, right, I guess you could provide extra rules for #parseToken to actually read your type of data.

best wishes,
Traian


2013/7/17 Stefan Ciobaca <stefan.ciobaca AT gmail.com>
Unfortunately, the stream="stdin" functionality works only with Ints
and Strings.

To solve your problem, try to read a string and convert it to Type afterwords.


Cheers,
Stefan

On Wed, Jul 17, 2013 at 3:43 PM, William Mansky <mansky1 AT illinois.edu> wrote:
> I'm working on writing some K definitions for a custom language, and I'm
> running into some weird errors. In particular, I'm trying to use the stdin
> stream to input some data from the user, but it seems like any input
> involving user-defined syntax fails to parse. I've shown a minimal example
> below. Does anyone know whether I'm making a mistake here, or whether this
> is a limitation of the current version of K?
>
>
> module DUD
>
>   syntax Type ::= "word"
>
>   configuration <T color="yellow">
>                   <k> .K </k>
>                   <in color="magenta" stream="stdin"> .List </in>
>                   <data> .K </data>
>                 </T>
>
>   rule <in> ListItem(X:Type) => . ...</in>
>        <data> . => X </data>
>
> endmodule
>
>
> When I run a sample program (the content is ignored, so irrelevant) and
> enter "word" (without the quotes), the result is a stuck configuration
> containing the term #parseToken("Type", "word") in <in>, rather than, as I'd
> hope, the term "word" in <data>. Any advice would be appreciated.
>
>
> Thanks,
> William
>
> _______________________________________________
> 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