Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following program does not compile correctly or type check correctly using the comp compiler and type inference system. However, it is a valid Standard
The following program does not compile correctly or type check correctly using the comp compiler and type inference system. However, it is a valid Standard ML program. Modify both the comp compiler and type checker to correctly compile and infer its type. This program is included in the compiler project as test20.sml.
let val [(x, y, z)]= [(1+s+s2 (h) ellop (,)1, true)] in printin x end Output from the type checker should appear as follows. 1 Typechecking is commencing... 2 Here is the AST I 3 letdec (bindval (listpat ([ tuplepat ( [idpat (x),idpat (y), idpat (z)])]), listcon ( [tuple ([str ("hello"), int (1), bool(true) ])])), [apply (id (println), id (x))]) 4 5 6 val [(x, y, z)] : (str * int *bool) list 7 val it unit : 8 The program passed the typechecker.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To correct the program and ensure it compiles correctly in Standard ML you can make the following ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started