Copyright © 2009 Tony Morris
Abstract
A hands-on introductory tutorial to monadic parsers using the Haskell Programming Language http://haskell.org/. Students will require an installation of the Glasgow Haskell Compiler http://haskell.org/ghc and a text editor. Upon completion of the tutorial students will have created a parser library.
Students will be expected to have a basic understanding of Haskell syntax and familiarity with tools -- in particular, the GHC interpreter (GHCi).
This document is released under a Creative Commons - Attribution, Non-Commercial, No Derivative Works licence. Appendix D, Licence
Table of Contents
Let us start by creating a file called MyParser.hs
. Then in that file the contents:
module MyParser where
import Data.Char
Start the GHC interpreter ghci
and load the source file.
$ ghci GHCi, version 6.10.2: http://www.haskell.org/ghc/ :? for help Prelude> :load MyParser.hs [1 of 1] Compiling MyParser ( MyParser.hs, interpreted ) Ok, modules loaded: MyParser. *MyParser>