Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why am i getting these compiler issues. Can somebody fix this sml code so that it compiles correctly and i can use the parse function?

Why am i getting these compiler issues. Can somebody fix this sml code so that it compiles correctly and i can use the parse function?

image text in transcribed

fun parse (fileName: string) : token list = let val file = TextIo. openIn(fileName) in createlist(TextIo. input1(file), file, []) end; fun createlist (c:char, file:TextIo.instream, acc:token list) : token list = if Char, isAlpha(c) then getword(Textio.input1(file), file, acc, [c]) case c of #"= createlist(Textio.input1(file), file, acc) #"= createlist(TextIO. input1(file), file, acc @ [EQ]) #"+ createlist(TextIo.input1(file), file, acc [ [PL]) | \#"-" createlist(TextIo.input1(file), file, acc @ [MI]) | "*" createlist(TextIo.input1(file), file, acc @ [TI]) "/" createlist(TextIo.input1(file), file, acc [ [DI]) else if c=nil then acc else print("Compilation error"); fun getword (c:char, file:TextIo.instream, acc:token list, tmp:char list) = if Char. isAlpha(c) then getword(TextIO.input1(file), file, acc, temp \& c) let val word = implode (tmp) In createlist(TextI0.input1(file), file, acc [ID word]) else if c=nil then acc else print("Compilation error") end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Pay for performance means employees must share

Answered: 1 week ago