Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why do I keep getting this error in my terminal after running this SML code? I need the parse function to work correctly fun parse

Why do I keep getting this error in my terminal after running this SML code? I need the parse function to work correctly

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 to Expert-Tailored 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

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions