15 ms·
Make a Lisp
- deleted 12y ago[deleted]
- shawndumas 12y agoIt's still a worthwhile effort even if all he did was aggregate them.
- rurban 12y agoLooking at the coding style he certainly wrote every single bit by his own. The code itself is standard of the shelf lisp introduction as done by good universities in the last decades. (SICP, Lisp in Small Pieces, ...). But bringing this simple code to the masses who just known C, python, perl, java, php or ruby is the interesting part. They can now relate to eval, tailcalls or an env.
- kanaka 12y agoThe forth and OCaml implementations were written from scratch by chouser (Chris Houser of "Joy of Clojure"). The rest were written from scratch by yours truly (kanaka/Joel Martin). However, it looks like there are a number of other implementations happening by other people now that HN has made it more visible.
- agumonkey 12y agoHis documentation and approach is priceless https://github.com/kanaka/mal/blob/master/process/guide.md https://github.com/kanaka/mal/blob/master/process/guide.md
- zw123456 12y agoVery cool, I am going to have to try out the C one. The only thing missing is HDL (Verilog or VHDL) but there are tons of those out there (e.g. https://github.com/jbush001/LispMicrocontroller https://github.com/jbush001/LispMicrocontroller)
- kmoe 12y agoThe language statistics ribbon for this is beautiful.
- hk__2 12y agoShameless plug, but I have a project with 24 languages if you want: https://github.com/bfontaine/Katas https://github.com/bfontaine/Katas
- careersuicide 12y agoThis is right up my alley. You might be interested in a project of mine I work on from time to time: https://github.com/seaneshbaugh/rosetta-euler https://github.com/seaneshbaugh/rosetta-euler
- hk__2 12y agoSweet!
- agumonkey 12y agoGood point. I wonder how many projects have that much languages in a single repo.
- devinus 12y agoThis is interesting. Since it's hard to read, I've extracted the language statistics and I'll leave them here: C# - 7.9% C - 7.2% Rust - 7.1% Visual - Basic - 6.6% Makefile - 6.5% Java - 5.8% Forth - 5.0% Go - 4.5% PostScript - 4.2% Haskell - 4.0% Shell - 3.8% Perl - 3.5% JavaScript - 3.4% Matlab - 3.2% Scala - 3.1% PHP - 3.1% OCaml - 3.0% Lua - 2.8% R - 2.7% Python - 2.7% CoffeeScript - 1.9% Ruby - 1.9% Clojure - 1.9% Scheme - 1.7% CSS - 1.4% Other - 1.1% It seems you could extrapolate interesting theories regarding productivity using these numbers. There's a jump between Ruby/CoffeeScript and Python, and I wonder why.
- barrkel 12y agoThe fact that C# came out with 36% more lines than Java would make me doubt much extrapolation about productivity from these numbers. You can do a token for token substitution of Java and end up with close to compilable C# code; there are only a handful of things Java has that C# doesn't, while C# has many more abstraction tools.
- zzalpha 12y agoWell, I know what I'm doing this weekend...
- 0942v8653 12y agoAt first I was surprised to see it implemented in Bash shell. Then I saw GNU Make.
- PinnBrain 12y agoHi--the project looks beautiful! Maybe the .gitignore could be improved?
- webnrrd2k 12y agoExcellent -- a much gentler version of Lisp In Small Pieces. (http://www.amazon.com/Lisp-Small-Pieces-Christian-Queinnec/dp/0521545668 http://www.amazon.com/Lisp-Small-Pieces-Christian-Queinnec/d...)
- jheriko 12y agonow if we can just have it for C please... :)
- wz1000 12y agohttp://www.buildyourownlisp.com/ http://www.buildyourownlisp.com/
- kanaka 12y agomal C implementation: https://github.com/kanaka/mal/tree/master/c https://github.com/kanaka/mal/tree/master/c Caveat, no GC. Although that could probably be added easily using the Boehm GC. I plan to do so at some point assuming nobody beats me to it.
- jheriko 12y agooh sorry, i meant if we can have a tiny C, or C-like compiler implementation. :) (although having a C implementation is awesome, even with the caveat) lisps are great as an instruction on the subject because of the clean and elegant design, but a C compiler requires tackling all kinds of very nasty problems... i'm sure it would be very valuable for people wanting to go even further with gaining a practical understanding of programming language/library implementation
- nathell 12y agoI like how it takes an incremental, step-by-step approach. One of my favourite papers is Ghuloum's "An Incremental Approach to Compiler Construction" [1], which shows how to build not a mere interpreter, but a _compiler_ to actual machine code, in twenty-four steps, starting from simple integers and proceeding through more and more advanced topics. Shameless plug: I've been trying to follow along, but making it entirely self-contained and avoiding any additional tools. The result (in very early stages, currently dormant but not quite dead yet) is called Lithium [2]. [1]: http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf [2]: https://github.com/nathell/lithium https://github.com/nathell/lithium
- neilparikh 12y agoI'm working on a lisp interpreter right now, so this should be useful for reference. One question, how would I go about implementing tail call recursion? I's assume that's a pretty important thing to have in lisp (or any functional language for that matter). I'm working in ruby, if that matters.
- mlni 12y agoI assume you already saw this by now: https://github.com/kanaka/mal/blob/master/process/guide.md#step-5-tail-call-optimization https://github.com/kanaka/mal/blob/master/process/guide.md#s...
- neilparikh 12y agoI did not, thanks for the link!
- codygman 12y agoObligatory cloc reading to see which implementations were shortest: ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Rust 17 294 155 3919 C 18 446 383 3356 C# 19 472 235 3314 Visual Basic 17 322 131 2945 Java 17 322 134 2872 Go 17 299 147 2636 Bourne Shell 16 304 241 2308 Perl 19 263 165 2167 Haskell 17 328 99 1951 MATLAB 25 176 114 1880 Javascript 23 263 145 1873 PHP 17 242 118 1791 Scala 16 219 113 1731 Lua 18 227 87 1715 Python 18 218 143 1393 Ruby 17 165 87 1219 OCaml 15 105 98 1154 Clojure 17 247 117 1011 CoffeeScript 17 193 126 989 CSS 6 150 132 792 make 26 233 59 580 HTML 1 17 27 227 C/C++ Header 6 47 9 172 Maven 1 2 7 72 ------------------------------------------------------------------------------- SUM: 380 5554 3072 42067 -------------------------------------------------------------------------------
- AnkhMorporkian 12y agoApparently Maven is uniquely suited for writing a LISP!
- klibertp 12y ago> Modern polyglot developers do not memorize dozens of programming languages. Instead, they learn the peculiar terminology used with each language and then use this to search for their answers. This is the clearest explanation of how polyglot programming works I ever read. Great work in general, very valuable resource for studying and comparing different languages. I'd like to add one more resource to the mentioned in the guide: http://rigaux.org/language-study/syntax-across-languages/ http://rigaux.org/language-study/syntax-across-languages/ - it's similar to hyperpolyglot, but has comparisons between non-related languages too. And focuses solely on syntax.
- kanaka 12y agoGood resource. Added.