News for hackers. Stuff that matters.
Re:A programming language in 450 lines of JavaScript by drewdahlman on Monday November 03, 2014 @06:11PM (#8554185)
Would love to see a little behind the scenes for this, maybe a write up / blog post. Pretty neat little experiment.
Re:A programming language in 450 lines of JavaScript by breuleux on Monday November 03, 2014 @08:07PM (#8554654)
I agree I should post one, but it usually takes me a lot of time, and I wasn't sure how much interest there would be. I'll start working on one.
Re:A programming language in 450 lines of JavaScript by bramgg on Monday November 03, 2014 @10:13PM (#8554963)
I started writing my own language in JavaScript last Summer but gave up after only writing the Lexer because I didn't know how to continue. I would LOVE to read this blog post!
Re:A programming language in 450 lines of JavaScript by Theyeard on Tuesday November 04, 2014 @04:21AM (#8555691)
Kaleidoscope - LLVM Tutorial [0] is an excellent resource with code samples in C++ and OCaml.

[0] http://llvm.org/docs/tutorial/index.html

Re:A programming language in 450 lines of JavaScript by eric_bullington on Tuesday November 04, 2014 @12:32PM (#8557793)
Agreed, it's an excellent resource. One of the best PL tutorials I've ever read.

But if you use the OCaml version with a recent version of OCaml, you'll run into a few issues. I sent in a patch with a few simple updates to the path mailing list earlier this year, but last I checked it wasn't merged.

Patch is here (it's a text file, despite the "bin" extension):

http://permalink.gmane.org/gmane.comp.compilers.llvm.cvs/183...

I also pasted the patch here:

http://pastebin.com/YvzB71nJ

Re:A programming language in 450 lines of JavaScript by d0m on Monday November 03, 2014 @11:54PM (#8555198)
Not all parsers need to be complex. If you're up for the challenge, read a bit on top-down parser and try to write it for your language!
Re:A programming language in 450 lines of JavaScript by kyberias on Tuesday November 04, 2014 @08:54AM (#8556460)
There may be better books but this was fairly pragmatic and I learned a lot: http://www.amazon.com/Programming-Language-Processors-Java-I...
Re:A programming language in 450 lines of JavaScript by pjmlp on Tuesday November 04, 2014 @05:24AM (#8555861)
Niklaus Wirth´s book about compiler construction is quite good.

It is available at his ETHZ site nowadays,

http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf

Re:A programming language in 450 lines of JavaScript by mishoo on Tuesday November 04, 2014 @02:58AM (#8555523)
I wrote a tutorial some time back — http://lisperator.net/pltut/ — also targeted at JS. It walks you through parsing, evaluating, continuations and CPS compiling.
Re:A programming language in 450 lines of JavaScript by Theyeard on Tuesday November 04, 2014 @03:27AM (#8555588)
Parsing, evaluating, continuations and CPS... it seems similar to this language: https://curiosity-driven.org/continuations#interpreter but the syntax is clearly different. Also, that interpreter is implemented in ~320 lines of JS.