Programming in LISP/Scheme/Racket

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Programming in LISP/Scheme/Racket

Josef8429
Hello to everybody, and first of all, THANKS a lot to the People, which made this incredible valuable book possible!!!
I just finished the "Hardware-part" of the book, and now I started looking for the best programming language to finish part two. Initially, I planned to do it with Python (I started a course at Codacademy), but I read also some texts about programming in general, and so LISP/Scheme came in my mind. Is it possible or would you recommend to write the software in part II with LISP/Scheme? For some reason, these languages have a certain fascination to me, so I am planning to learn them. Do I really need a "modern" language like Python, or could I do the Projects of part II with this "ancient" language?
Greeting, Josef
Reply | Threaded
Open this post in threaded view
|

Re: Programming in LISP/Scheme/Racket

cadet1620
Administrator
You are much better off using a modern language that has good support for string parsing and dictionary/map data structures.  I think that you will get caught up in the details of implementing basic functions instead of implementing the tools themselves if you use Lisp/Scheme.

Another reason is that you will be able to expect support from forum users if you are writing in a language that most programmers can read.  Example: I don't write much Java or Ruby, but I can read them well enough to support people writing in them.  The last time I wrote any Lisp was in 1977!

(I wrote my n2t tools in Python.)

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Programming in LISP/Scheme/Racket

ivant
In reply to this post by Josef8429
I'm a big fan of the Lisp family of languages. If you want a modern Lisp, then I suggest to take a look at Clojure. It runs on the JVM, has great interoperability with Java and has a very supportive community.

That said, you may find it easier to learn one new thing at a time. If you don't already know Lisp/Scheme/Clojure, you may spend a lot of time searching for trivial things like file IO, instead of thinking how to write the compiler.
Reply | Threaded
Open this post in threaded view
|

Re: Programming in LISP/Scheme/Racket

jsaff
In reply to this post by Josef8429
I just finished the compiler and vm translator using common lisp. Lisp is an excellent language for doing this project. Most of the software is just manipulating lists of instructions and lisp is built for exactly that.

As an example, you can write the vm translator as basically a back-quoted list of asm instructions:-

(defun write-hack-if (label)
  `("@SP" "AM=M-1" "D=M" ,(format nil "@~A" label) "D;JNE"))

which just returns the asm with the ~A in the "@~A" instruction replaced with the label the function was passed.

The file system integration did take some work - the lisp documentation is very technical and I definitely felt very noobie-ish trying to get my head around it. I also used one string manipulation library, Alexandria, mainly to access a string based switch function which is a bit more readable than doing the same using COND. It is not at all necessary.

The only downside to lisp I can see is the cousera course won't let you submit assignments in it!

JS
Reply | Threaded
Open this post in threaded view
|

Re: Programming in LISP/Scheme/Racket

ybakos
@jsaff: Cool!