Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (21 sloc) 398 Bytes
{
module Lexer where
}
%wrapper "basic"
$digit = 0-9
tokens :-
$white+ ;
"#".* ;
"(" { \s -> LParen }
")" { \s -> RParen }
$digit+ { \s -> Int (read s) }
[\+\-\*\/] { \s -> Operator (head s) }
{
data Token =
LParen
| RParen
| Int Int
| Operator Char
deriving (Eq, Show)
lex = alexScanTokens
}