Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

NEED LISP HALP

Name: Anonymous 2009-10-20 6:18

Hey /prog/riders,
for a school project i must write a LISP interpreter in JAVA. I've read SICP but there's no implementation of the interpreter in J2EE.
How can i do that?

ps : Sensei love enterprise quality code.

Name: Anonymous 2009-10-20 7:14

Just write a simple recursive descent parser, it's rather simple for lisp. If you end up with more than about 500 lines of C code for the entire interpreter you are doing something wrong. As far as doing it in java, private static final String code = "
    #include <stdio.h>
    #include <stdlib.h>
    FILE* f;
    int main(int argc, char **argv) {
        if(argc <= 1) {
            fprintf(stdout, \"Usage: %s [filename]\", argv);
            exit(1);
        }
        f = fopen(*argv++);
        if(f == null) exit(1);
        readFile(f);
        sExpression();
        interpret();
        return 0;
    }";
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileOutputStream("lisperu.c")));
pw.write(code);
pw.close();
Runtime.getRuntime().exec("gcc -O3 -o lisperu ./lisperu.c");
Runtime.getRuntime().exec("./lisperu testProgram.lisp");

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List