I wanted to share how I’ve finally settled on my haskell development environment and how I got it set up, since the process in the end wasn’t that trivial. Hopefully anyone else starting in haskell can avoid the annoyances and pitfalls that I ran into and get up and running (and doing haskell) quickly.
First, download the haskell platform from haskell.org. This is pretty easy. At this point you should have
ghc (the compiler) and
ghci (the interactive REPL) installed and in your path.
Aslo at this point you should have
cabal installed. Cabal is haskells package manager. It’s like ruby gems, or .NET nuget, or node’s NPM (gah, so many!).
Get sublime text
As much of a visual studio fanboy that I am, I have to say that using sublimetext for haskell has turned out to be really nice. Most of the haskellers I asked on … Read more
In my previous post about building a custom lexer I mentioned that, for educational purposes, I created a simple toy programming language (still unnamed). There, I talked about building a tokenizer and lexer from scratch. In this post I’ll discuss building a parser that is responsible for generating an abstract syntax tree (AST) for my language. This syntax tree can then be passed to other language components such as a scope and type resolver, and finally an interpreter.
The parser I made is a recursive descent packrat parser that uses backtracking. Short of memoizing found AST, there aren’t any other real optimizations. The goal was to create a working parser, not a production parser to distribute or use (or reuse) in any professional sense. Like the lexer, this is an academic exercise to try and hit on some of the points covered by Terence Parr’s Language Implementation Patterns book that … Read more