-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAIN.hs
40 lines (35 loc) · 891 Bytes
/
MAIN.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import PARSER
import LEXER
import System.Environment (getArgs)
import Typing
import Evaluator
import Ast
main = do
args <- System.Environment.getArgs
--s <- getContents
s <- readFile (head args)
--d <- getLine
putStrLn ""
print "Scan Tokens are : "
let a = scanTokens s
print a
putStrLn ""
print "Parser Output is :"
let b = parser a
print b
putStrLn ""
print "Preorder Traversal of Parser Output is :"
print (preordera b)
putStrLn ""
print "Type Checking :"
let c=check b [] [] []
if ((c==INTs)||(c==BOOLs))
then print "Given Programme is Semantically Correct (Type Checking is OK) with resulting type as "
else print c
print c
putStrLn ""
print "Evaluating Programme (Final Result) :"
let d = evalu b [] [] []
if (c==BOOLs)
then print (reconvert d)
else print d