Learn C and build your own Lisp
buildyourownlisp.com
Learn C and build your own Lisp
1–10 of 150 posts
Re: Learn C and build your own Lisp
#2Re: Learn C and build your own Lisp
#3EDIT: Fixed now.
Re: Learn C and build your own Lisp
#4How good is this book for a complete beginner? I am starting to learn C in my free time and I have no objective way to judge this book.
Re: Learn C and build your own Lisp
#5I've implemented a few simple implementations of basic (and not so basic) type systems[1]. Currently, only 3 type systems are finished (Hindley Milner's Algorithm W, and Daan Leijen's extensible rows and first-class polymorphism), while gradual typing is almost done (based on [2], in branch 'dev').
[1] https://github.com/tomprimozic/type-systems
[2] Jeremy G. Siek, Manish Vachharajani - Gradual Typing with Unication-based Inference - http://ecee.colorado.edu/~siek/dls08igtlc.pdf
Re: Learn C and build your own Lisp
#6How good is this book for a complete beginner? I am starting to learn C in my free time and I have no objective way to judge this book.
Re: Learn C and build your own Lisp
#7Often, the code is more complicated than I find reasonable, while omitting things that make a lot of sense in "real" code, and it's very hard to know as an outside reader what the exact motivation for each decision was, by the author.
A few such things that caused me to WTF:
The initial few examples use a pointlessly static and global line buffer, instead of declaring the line buffer where it's being used.
There is hardly any const in the code, even for cases where it obviously should (to me) be used, i.e. for variables that are never written once given their initial value.
A magic number (the buffer size 2048) is repeated in the code, and even encoded into a comment, instead of just using "sizeof buffer".
I do think I found an actual bug (on http://www.buildyourownlisp.com/chapter4_interactive_prompt)... the readline() implementation ignores its prompt argument and uses a hardcoded string, instead. The same function also does strcpy() followed by using strlen() to truncate the string it just copied; that really doesn't sit well with me.
Re: Learn C and build your own Lisp
#8How good is this book for a complete beginner? I am starting to learn C in my free time and I have no objective way to judge this book.
That being said I'm not entirely convinced that implementing a programming language is the best toy project for learning C since one of the first things you have to write is a parser and we all know string handling in C is a pity.
That being said it looks very interesting, I know C quite well but I might read it for the "implementing lisp" parts.
Re: Learn C and build your own Lisp
#9How good is this book for a complete beginner? I am starting to learn C in my free time and I have no objective way to judge this book.
However, if you're serious about learning C then I strongly recommend getting the K&R book [0]. It's short and quickly gets down to business --- the first chapter alone gives you a condensed but working overview of the language as a whole.
Even experienced C programmers seem to keep the book around as it's good as a reference as well.
I strongly recommend people to learn C. It's a small, beautiful and very powerful language and the lingua franca for language ABIs. In fact, many popular dynamic languages are implemented in C (Python, Ruby, Lua and countless others).
Your time will be well spent!
[0]: http://en.wikipedia.org/wiki/The_C_Programming_Language
Re: Learn C and build your own Lisp
#10How good is this book for a complete beginner? I am starting to learn C in my free time and I have no objective way to judge this book.