Question: (* this code is named a2.sml, when loading it into my sml enviornment, I am getting these error messages [opening a2.sml] a2.sml:5.5 Error: syntax error:

(* this code is named a2.sml, when loading it into my sml enviornment, I am getting these error messages

[opening a2.sml] a2.sml:5.5 Error: syntax error: inserting VAL a2.sml:6.5 Error: syntax error: inserting VAL a2.sml:7.5-7.8 Error: syntax error: replacing REC with FUN a2.sml:8.9 Error: syntax error: inserting VAL a2.sml:9.16-10.6 Error: syntax error: deleting WITH BAR a2.sml:10.7 Error: syntax error: inserting COLON a2.sml:11.5 Error: syntax error: replacing BAR with COLON a2.sml:12.32-13.10 Error: syntax error: deleting WITH BAR a2.sml:13.39 Error: syntax error: inserting SEMICOLON a2.sml:14.9-14.18 Error: syntax error: deleting BAR IDA ARROW a2.sml:14.19 Error: syntax error: inserting END a2.sml:18.1 Error: syntax error found at EOF [unexpected exception: Compile]

*) (*please help!!!!!!!!!!!!*)

fun strip (inputFile:string, outputFile:string) : unit =

let input = TextIO.openIn inputFile in

let output = TextIO.openOut outputFile in

let rec processLine () =

let line = TextIO.inputLine input in

match line with

| None -> TextIO.closeIn input; TextIO.closeOut output

| Some s ->

match Int.fromString s with

| Some i -> TextIO.outputLine output (Int.toString i); processLine()

| None -> processLine()

in

processLine();

TextIO.closeIn input;

TextIO.closeOut output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!