Question: 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

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

1 Expert Approved Answer
Step: 1 Unlock

To correct the program and ensure it compiles correctly in Standard ML you can make the following ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!