I have written a Lisp Interpreter in Java, hope you'll like it.Feel free to contact me, once you run it, you'll know the my email address .Enjoy.how to run it?java -jar LispInterpreter.jaror use Makefilemake runmake run-1stpartmake run-evaloff etc ...how many lines of code?$ find -type f -name "*.java" | xargs cat | wc -l1663how do I write it?eclipse + git (github)which version of java?1.6what features does it have?if you know clisp, then it's pretty much the sameif you don't know clisp, well, learn lisp first.features:T NIL CAR CDR etc is supportedDEFUN is supported (well, what else do you want if defun is supported ?)Fault detection is quite goodMultiple switches for project: evaloff (default is on); listprintoff (default is on); lowercaseoff (default is on); lowercasesameoff (default is on)Makefile, README and design.txt tell you everything in detail.You can change it using eclipse or just command line, because makefile is readyis there bug?as far as I know, no critial bug. contact me if you find onesource code ?I have released the source code, I am no more interested in this project. You can get the latest copy (in case I've updated something in the future) by :$ git clone git://github.com/hdc1112/lisp_interpreter_in_javasome old screenshots, much has changed since then: README file:README for Lisp Interpreter in JavaDachuan [email protected]. how to use the interpreter? make (or make compile)::: to compile the whole program::: make sure that you do this after you modify the source code or there is not .class file in bin/make run ::: to run the interpreter ::: by default, eval is on && list printing is on && lower case letter is on && case insensitivemake run-1stpart ::: to run the interpreter in input&eval mode, and list printing is forbiddenmake run-evaloff-listprintoff::: to run the interpreter in input&eval mode, and list printing is forbiddenmake run-evaloff::: to run the interpreter in input&eval modemake jar::: to create a runnable jar filemake clean::: delete *.class and other trivial filesmake help::: if you need helpmake run XARGS="lowercaseoff" ::: forbid the lower case letters inputmake run XARGS="lowercasesameoff" ::: make this project case sensitive (built-in functions are still CAPITAL)!!!!!IMPORTANT!!!!! if your input is from file, you can do it in this way:(using pipe or redirection)cat test.txt | make run-1stpart   OR   make run-1stpart cat test.txt | make run        OR   make run DON'T DO IT IN THIS WAY:(THIS IS WRONG) make run-1stpart `cat test.txt` (THIS IS WRONG)2. what are the files in the project?the folder is a eclipse project folder, which means I developed it in eclipse, and you can import it to eclipseyou can also git clone this project:git clone git://github.com/hdc1112/lisp_interpreter_in_java.git.├── bin                *.class files will go here├── Makefile            makefile, you know├── manifest.txt        if you want a runnable jar file, you will probably need this├── README            that's me└── src                Source code folder    ├── Evaluate.java        Interpreter's 2nd component, Evaluator, it accepts a legal S-Exp    ├── Input.java        Interpreter's 1st component, Input, it reads a legal S-Exp from stdin    ├── LispBuiltin.java    Intrepreter's built-in functions' implementation    ├── LispInterpreter.java    Interpreter    ├── ***p.java        the Java class for S-Expression in Lisp    └── UnitTest.java        the test code, only for development purpose3. I have tested the whole project with many test cases, here are them if you are interested:(if you are in input&output mode)1) 23 passed2) (23 . 24) passed3) (23 . (24 . 25)) passed4) ( 23 . (24 . 25)) passed5) (\t 23 . (24 . 25)) passed6) (23 . 24 \n ) passed7) (2 3) passed8) (2 3 ) passed9) (2 3 4 5 6 7 8 9 ) passed10) (2 (3 . 4)) passed11) (2 (4 . 5 ) ) passed12) ((2 . 3) (4 . 5)) passed13) ((2 3) (4 5)) passed14) ((2 3 4 5) 23 ) passed15) (+24) passed16) (-24 +24 -5 +6) passed17) (2 \n\n\n . \n\n\n 3) passed18) (2 3 . 5) passed (should fail, and should restart normally)19) 20) (23 ] passed (should fail, and should restart normally)21) (2 5 6 7 1 \n 23 (2 . 4) 3 (4 5) \n ) passed22) if ***p is a List, then Print in list notation. passed23) A passed24) (A 23 (A . 3)) passed25) (A . B) passed(if you are in input&eval mode)26) 23 passed27) a "only capital letter is allowed"28) A "unbound identifer A"29) (2 3) "function name should start with capital letter"30) (A 3) "function not defined: A"31) (QUOTE (2 3 3 3 3)) passed32) (COND (T NIL)) passed33) (COND (NIL T) (T NIL)) passed34) (COND (NIL T ) ( T T)) passed35) (COND A) "car error: shouldn't be an atom "36) (COND (A NIL)) " unbound identifer A"37) (COND (NIL NIL)) "there should be at least one condition which is true"38) (2 . 3) "illegal function call format"39) (2 3) "function name should start with capital letter"40) (2 . (3 . NIL)) "function name should start with capital letter"41) (CAR (2 . 3)) "illegal function call format"42) (CAR (QUOTE (2 . 3))) passed43) (EQ (QUOTE A) (QUOTE A)) passed44) (PLUS 222 -90) passed45) (MINUS 222 -90) passed46) (LESS 2 (QUOTE A)) "should both be an integer"47) (LESS (QUOTE 2) (QUOTE 3)) passed48) (COND (T NIL)) passed49) (COND (NIL T)) "at least one condition should true"****test cases for defun****50) (DEFUN APPEND (L1 L2) (COND ((NULL L1) L2) (T (CONS (CAR L1) (APPEND (CDR L1) L2))))) passed51) (APPEND (QUOTE (2)) (QUOTE (2))) passed52) (DEFUN XMEMB (X LIST) (COND ((NULL LIST) NIL) ((EQ X (CAR LIST)) T) (T (XMEMB X (CDR LIST))))) passed53) (XMEMB 2 (QUOTE (2 3))) passed54) (DEFUN XMEMB (X LIST) (COND ((NULL LIST) NIL) ((EQ X (CAR LIST)) T) (T (XMEMB X (CDR LIST))))) passed55) (XUNION (QUOTE (3 4)) (QUOTE (4 5))) passed56) (DEFUN EQUAL (X Y) (COND ((ATOM X) (COND ((ATOM Y) (EQ X Y)) (T NIL))) ((ATOM Y) NIL) ((EQUAL (CAR X) (CAR Y)) (EQUAL (CDR X) (CDR Y))) (T NIL))) passed57) (EQUAL (QUOTE (2 . 3)) (QUOTE (2 . 3))) passed58) (DEFUN ATOMSLIST (S) (COND ((NULL S) NIL) ((ATOM S) (CONS S NIL)) (T (APPEND (ATOMSLIST (CAR S)) (ATOMSLIST (CDR S)))))) passed59) (ATOMSLIST (QUOTE ((2 . 3) . 4))) passed60) (DEFUN CHECK2 (S) (COND ((NULL S) NIL) ((XMEMB (CAR S) (CDR S)) T) (T (CHECK2 (CDR S)) ) )) passed61) (DEFUN CHECK (S) (CHECK2 (ATOMSLIST S))) passed62) (CHECK (QUOTE ((2 . 3) . 2))) passed63) (QUOTE (2 .3)) found a bug. fixed on 2/14/201264) (.3) "we don't support floating number"
09-28 03:08