Skip to content

Comment on Show HN: Vivaldi programming languageparent

Comments

Got any recommendations for resources to get started creating one's own language?

Pat Shaughnessy's Ruby Under a Microscope[1] is a fantastic resource for looking at Ruby's internals, especially concerning parsing, Ruby's class structure, and the YARV virtual machine.

It's probably easiest to begin with a Lisp dialect, since a basic one needs only two data types (singly-linked lists and symbols) and its eval function is so simple. Peter Norvig has a great tutorial[2] on implementing a Lisp in Python.

Beyond that, it can be helpful to look at the source code for other languages similar to what you're looking to create, to get a sense of how they do things.

That's more or less what I found helpful, in any case. Good luck!

[1] http://patshaughnessy.net/ruby-under-a-microscope [2] http://norvig.com/lispy.html

For the parsing aspects, reading about parser generators or the like would be super useful

I would not recommend using a parser generator tool to build a recognizer por any programming language,unless you design your language to be LL(1) or LL(k) witk a low value of k. Otherwise you are going to suffer a lot with parsing issues.

Parser generators usually have a very limited number of target languages, so you might find yourself stuck into a language you do not want to code in.

hmm, your results may vary (whitespace-sensitive languages, but that's tricky in pretty much any toolkit), but in my experience most DSLs that people want to write fit well within LL(k). Java works in it, after all.

I started out with Yacc, though, and that helped me out a lot more...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.