See also the HTML version of the source code for the Lexer for Haskell in Haskell.
Name | Last modified | Size |
---|---|---|
Parent Directory | - | |
Lexer/ | 2009-01-04 11:20 | - |
LexerGen/ | 2009-01-04 11:21 | - |
LexerSpec/ | 2009-01-04 11:34 | - |
Parser/ | 2005-06-01 23:00 | - |
hi/ | 2014-02-05 22:42 | - |
HuMakefile | 2003-09-30 19:11 | 79 |
ParsedSyntax.hs | 2001-12-08 01:03 | 127 |
lexgen | 2001-11-30 01:55 | 145 |
NumberNames.hs | 2001-12-08 02:18 | 216 |
PosName.hs | 2004-04-02 23:34 | 238 |
cgiconfig.sh | 2020-07-31 11:07 | 423 |
Makefile | 2009-01-04 11:18 | 940 |
ParserOptions.hs | 2005-10-11 01:09 | 969 |
index_inc.html | 2008-12-31 13:50 | 1.0K |
LexUtil.hs | 2001-11-16 23:35 | 1.4K |
ParseMonad.hs | 2006-06-09 22:39 | 2.1K |
SourceNames.hs | 2009-01-04 11:18 | 2.4K |
LexerNotes.html | 2003-05-08 20:37 | 3.1K |
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