See also the HTML version of the source code for the Lexer for Haskell in Haskell.
Name | Last modified | Size |
---|---|---|
Parent Directory | - | |
HuMakefile | 2003-09-30 19:11 | 79 |
LexUtil.hs | 2001-11-16 23:35 | 1.4K |
Lexer/ | 2009-01-04 11:20 | - |
LexerGen/ | 2009-01-04 11:21 | - |
LexerNotes.html | 2003-05-08 20:37 | 3.1K |
LexerSpec/ | 2009-01-04 11:34 | - |
Makefile | 2009-01-04 11:18 | 940 |
NumberNames.hs | 2001-12-08 02:18 | 216 |
ParseMonad.hs | 2006-06-09 22:39 | 2.1K |
ParsedSyntax.hs | 2001-12-08 01:03 | 127 |
Parser/ | 2005-06-01 23:00 | - |
ParserOptions.hs | 2005-10-11 01:09 | 969 |
PosName.hs | 2004-04-02 23:34 | 238 |
SourceNames.hs | 2009-01-04 11:18 | 2.4K |
lexgen | 2001-11-30 01:55 | 145 |
pfe.cgi | 2018-03-29 23:19 | 6.3K |
PosSyntax
. It
reuses the names of all types from the plain abstract syntax, to
minimize the number of changes required in the grammar file. The type
used for identifiers with source position is called SN
and defined in module SourceNames
.
Instead of being handwritten in Haskell, the new lexer is generated from a lexical syntax specification. The advantages with this approach are that
The specification is expressed in Haskell, using simple regular expression combinators, and then compiled to a DFA using standard text book algorithms. The regular expression compiler is implemented in Haskell, and the DFAs it generates are output in the form of Haskell source code.
Two pieces of handwritten code accompany the automatically generated code:
Lexer
LexerGen
LexerSpec
Parser