Live data from Hacker News

Ask HN: What's a starting point for learning how to write programming languages?

news.ycombinator.com

31–40 of 105 posts

Re: Ask HN: What's a starting point for learning how to write programming languages?

#31

Earlier quoted context omitted.

Absolutely not for a markdown parser, which is what the author is asking about to get started

Parsing is but 1/3 of compiling. Markup languages are not generally thought of as programming languages, but maybe that's an archaic view. At any rate, 90% of the material in this thread is way overkill if all one wants to do is parse Markdown.

[deleted]

Re: Ask HN: What's a starting point for learning how to write programming languages?

#32
post #13

Chris Lattner, the creator of Swift has a nice walkthrough for making a small language called Kaleidoscope http://web.cs.ucla.edu/classes/spring08/cs259/llvm-2.2/docs/...

This is a better link: https://llvm.org/docs/tutorial/ That page is using a 10+ year old version of LLVM

Re: Ask HN: What's a starting point for learning how to write programming languages?

#33
Write lexers and parsers for data formats, JSON and EDN are two good starting points.

write a forth or lisp lexer, parser and interpreter.

then write a small language that compiles to a target, like js, make sure your language is close in semantics to the target language to avoid headaches.

Re: Ask HN: What's a starting point for learning how to write programming languages?

#34
Probably the greatest amount of growth I've had in my lifelong programming journey was during the years when I was working on making my own scripting language. I think the skills I learned have shaped how I approach other programming project. Think debugging is hard? Try debugging why your script interpreter isn't running a given script correctly.

Re: Ask HN: What's a starting point for learning how to write programming languages?

#36

A Forth or a Lisp are simple tasks for an experienced programmer, and even basic ones are really satisfying imho. Seeing simple constructs work in an hour of coding really feels great. I implemented more complex languages (with types) for work which were more like DSLs but in languages less suited for the type of DSL we required, but I find most pleasure doing little Forth (like [1]) or Lisp likes when I am waiting f…

Someone wrote an amazing write-your-own lisp using Python tutorial, I found it amazingly consumable and it only took a weekend:

https://github.com/kvalle/diy-lang

Re: Ask HN: What's a starting point for learning how to write programming languages?

#37
There's more than a few ways to do it.

Ohm [0] is a good place to start. It's a parser generator. If you can understand the math example [1], you can probably realize how things get built upwards. Then you can focus on what you want your language to do, how you'll interpret it, what problems it would express, &c.

[0] https://ohmlang.github.io/

[1] https://github.com/harc/ohm/blob/master/examples/math/index....

Also consider reading about OMeta, if Ohm isn't your thing.

Re: Ask HN: What's a starting point for learning how to write programming languages?

#38
I am working on my first programming language. I decided to use Racket and I am using the book Beautiful Racket and miscellaneous blog articles to guide me.

I started out just working on a set of linked/cooperating libraries and then decided to offer both the libraries and a custom language. I am writing something for my own use but when I release the MVL, I obviously also hope to get users and pull requests.

Re: Ask HN: What's a starting point for learning how to write programming languages?

#40
For me the starting poin was Structure and Implementation of Computer Programs, particularly the 80's lecture recordings.

Also I would recommend staying away from lexer and parser generators and just use hand built recursive descent parser and some set of ad-hoc lexical analysis subroutines.

Post reply on HN