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: Stefan Ciobaca <stefan.ciobaca AT gmail.com>
  • To: William Mansky <mansky1 AT illinois.edu>
  • Cc: k-user AT cs.uiuc.edu
  • Subject: Re: [K-user] K input?
  • Date: Wed, 17 Jul 2013 16:05:16 +0200
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

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




Archive powered by MHonArc 2.6.16.

Top of Page