Answered step by step
Verified Expert Solution
Link Copied!

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.

image

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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions