Hi

Can someone give example of parsing using zetta-parser for the case that 
the input stream is intermittent (i.e. possibly incomplete at a particular 
moment).
The author of zetta-parser refers to this very possibility in his readme 
(for example parsing messages arriving at a socket or such).

My particular application is interacting with several command line programs 
in MS Windows.
So I need to parse the characters coming from the program's output streams 
(stdout and stderr).
The interaction really is interactive, so for example, when I start the CL 
program, I might get a lot of lines of output followed by a prompt 
"TypeNow>" kind of thing.
So I want the parser to skip the lines and return when it sees the prompt.
Now I might send a character or string to the CL program's stdin and then 
get more (differently structured) output to parse.
And so on.
I cannot change these CL programs because they are provided by third 
parties; they were written with a view to interacting with a human, not a 
program.

It seems to me that this kind of parser is perfect for this job - but I'm a 
newbie at monads etc so I don't know how to express it in zetta-parser 
syntax. (I'm also not familiar with Haskell).

BTW The Win32 treatment of the streams associated with a command line 
program is completely broken, in the sense that the stdout stream is 
*buffered*, so as it stands it is not possible to interact like this with a 
console program. You don't get to see the buffered output until either the 
buffer fills up, or the program terminates. Either way, it's not 
interaction.
This of course also carries over the Java version using 
java.lang.RunTime.exec. If one tries to run an interactive program by this 
means, it just hangs up. In order to achieve interactivity I have had to 
create a truly horrible CL program runner written in C (which I start and 
interact with via a JNI interface) that infers the output from stdout and 
stderr by continually examining the console output buffer (i.e. the screen).

Best regards, Tim

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to