So this[1] post recently made its way across the HN front page, which I found serendipitous given my current side project. There's nothing terribly groundbreaking in my language— everything in it is basically taken from Ruby, Scheme, or Python— but I certainly learned a lot making it, and maybe some of y'all will find something of interest in it.
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!
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...
Comments
So this[1] post recently made its way across the HN front page, which I found serendipitous given my current side project. There's nothing terribly groundbreaking in my language— everything in it is basically taken from Ruby, Scheme, or Python— but I certainly learned a lot making it, and maybe some of y'all will find something of interest in it.
[1] https://news.ycombinator.com/item?id=9040029
Nice work! What was the motivation for creating the vivaldi language?
Hey! Creator of Wake here.
This looks like a nice language! Lots of syntactic niceties, and it looks extremely feature complete.
Nice work! I'm not surprised you learned a lot given how many features it supports!
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...
why mutable strings, why ?