Skip to content

Instantly share code, notes, and snippets.

@rusimody
rusimody / lex-lonlines.hs
Created October 29, 2012 16:02
Shortened lexer
-- This lexer is not completely faithful to the Haskell lexical syntax.
-- Current limitations:
-- Qualified names are not handled properly
-- Octal and hexidecimal numerics are not recognized as a single token
-- Comments are not treated properly
lex :: ReadS String
lex "" = [("","")]
lex (c:s)
@rusimody
rusimody / lexOrig.hs
Created October 29, 2012 16:01
The Original Lexer from the standard prelude
-- This lexer is not completely faithful to the Haskell lexical syntax.
-- Current limitations:
-- Qualified names are not handled properly
-- Octal and hexidecimal numerics are not recognized as a single token
-- Comments are not treated properly
lex :: ReadS String
lex "" = [("","")]
lex (c:s)