From 86ee39f44266cb314ab36c4f941377620fc0fead Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Mon, 24 Apr 2023 13:09:55 +0100 Subject: Remove redundant subex/main.main function --- subex/main.go | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) (limited to 'subex') diff --git a/subex/main.go b/subex/main.go index bb688e9..ae829d9 100644 --- a/subex/main.go +++ b/subex/main.go @@ -1,9 +1,6 @@ package subex import ( - "os" - "fmt" - "bufio" "main/walk" ) @@ -125,49 +122,3 @@ func RunTransducer(transducer SubexState, input []walk.Atom) (output []walk.Atom } return nil, true } - -func Main() { - if len(os.Args) != 2 { - panic("Expected: program [subex]") - } - program := os.Args[1] - reader := &StringRuneReader { - input: program, - pos: 0, - width: 0, - } - ast := Parse(reader) - transducer := CompileTransducer(ast) - - stdin := bufio.NewReader(os.Stdin); - jsonStream := walk.Json(stdin); - tokenStream := make(chan walk.WalkValue) - go func(in <-chan walk.WalkItem, out chan<- walk.WalkValue) { - for item := range in { - out<-item.Value - } - close(out) - }(jsonStream, tokenStream) - - var tokens []walk.WalkValue - for token := range tokenStream { - tokens = append(tokens, token) - } - - atoms := walk.Atomise(tokens) - - output, err := RunTransducer(transducer, atoms) - if err { - fmt.Println("Error") - return - } - - valueOut, error := walk.Compound(output) - if error != nil { - fmt.Println(error.Error()) - return - } - for _, value := range valueOut { - fmt.Println(value) - } -} -- cgit v1.2.3