Upgrade is finished. Everything should be working now.

Commit bd9a889d authored by Tadej Borovšak's avatar Tadej Borovšak
Browse files

Start of homework

parent 9376e0e6
......@@ -23,5 +23,3 @@ data Com =
Skip |
While (BExp, Com)
deriving Show
module Imp_Evaluator where
import Imp_AbsSyntax
import Imp_State
......
-- vim: set syntax=alex autoindent
{module Imp_Lex where }
......@@ -6,34 +7,38 @@
-- character classes
$digit = [0-9]
$lower = [a-z]
$upper = [A-Z]
$alpha = [A-Za-z]
:-
-- lexical classes
--
-- [[IMPLEMENT YOUR LEXICAL CLASSES HERE]]
--
$white+ ; -- whitespace
\( | \) {\s -> SCOPE s} -- scope
\; {\s -> DELIM} -- command delimiter
\+ | \- | \* {\s -> OP s} -- arithmetic ops
\=\= | \< {\s -> OP s} -- boolean ops
\:\= {\s -> ASSIGN} -- assignment
if | then | else {\s -> KEYWORD s} -- if command
while | do {\s -> KEYWORD s} -- while command
skip {\s -> KEYWORD s} -- skip command
True | False {\s -> BOOL $ read s} -- boolean literals
$digit+ {\s -> NUM $ read s} -- numbers
$alpha [$alpha $digit \_]* {\s -> LOC s} -- locations
{
-- The Token type - the action for each lexical class has type String -> Token
data Token =
--
-- [[IMPLEMENT YOUR Token TYPE HERE]]
--
data Token = SCOPE String
| DELIM
| OP String
| ASSIGN
| KEYWORD String
| BOOL Bool
| NUM Integer
| LOC String
| INVALID
deriving Show
-- The lexer implements a function
--
-- imp_lex :: String -> [Token]
--
-- which converts a string containing Imp program text into a list of tokens
imp_lex = alexScanTokens
}
-- vim: set syntax=happy
{module Imp_Parse where
import Imp_Lex
import Imp_AbsSyntax
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment