Hacker Newsnew | past | comments | ask | show | jobs | submitlogin



That's pretty cool :)

To be fair, though, the 450 lines include about 120 lines of comments, a configurable full operator precedence parser, syntax for array creation and indexing, range and looping operators, short-circuit logical operators...

Most minimal language implementations skimp on syntax because it is irrelevant to a language's expressive power. The point of this exercise, though, was to make one that didn't.


Yours is a lisp-like, so much easier to parse; and it doesn't have the nice in-dom ast viewer nor nearly the same number of comments (I compared with http://eloquentjavascript.net/code/chapter/11_language.js).


Still very interesting


It's even more interesting because it's part of book. Just setting the expectations, because it's not an apple-to-apple comparison.


The AST viewer is not included in the 450 lines, although the comments are. Most of the difference is due to the more sophisticated parser and some extra features like arrays.


How about 49 lines?

https://github.com/samphilipd/the-little-schemer/blob/master...

I wrote an implementation of Scheme in Javascript to use as I work through the excellent book 'The Little Schemer'. Turns out you can implement a basic version of the language in just 7 functions.

It's Turing complete and you can use the base methods to build any function you need.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: