Hi all,
I have a program that parses a file and emits AST that is essentially
sexps. I'd like to be able to send a stream of tokens and get the output
stream of sexps from within common lisp (SBCL is what I am using). Is
there an easy way of doing this? I can open a file, write to it and then
run:
./myprog < input > output
then read in the output but that is pretty clunky. The other thing I
thought about was to change the c function from:
int main (int argc, char *argv[])
to
char* main (char *inpt)
and use cffi but this has some problems as then everything is strings
which means I'd have to deal with special characters.
I guess I'm assuming there is a much simpler and clean of doing what I
want. If anyone can throw me a bone I'd appreciate it.
Thanks,
Jason
On Aug 3, 3:36 pm, Jason Nielsen <····@cs.sfu.ca> wrote:
> Hi all,
>
> I have a program that parses a file and emits AST that is essentially
> sexps. I'd like to be able to send a stream of tokens and get the output
> stream of sexps from within common lisp (SBCL is what I am using). Is
> there an easy way of doing this? I can open a file, write to it and then
> run:
>
> ./myprog < input > output
>
> then read in the output but that is pretty clunky. The other thing I
> thought about was to change the c function from:
>
> int main (int argc, char *argv[])
>
> to
>
> char* main (char *inpt)
>
> and use cffi but this has some problems as then everything is strings
> which means I'd have to deal with special characters.
>
> I guess I'm assuming there is a much simpler and clean of doing what I
> want. If anyone can throw me a bone I'd appreciate it.
1) SBCL-specific questions are better asked on sbcl-help
2) look at the arguments to run-program, you can give a stream for
stdin and get a stream for stdout.