<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-24 13:09:55 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-24 13:09:55 +0100
commit86ee39f44266cb314ab36c4f941377620fc0fead (patch)
tree7660f3a7a781218008103ff6e279ace659fcb52e /subex
parent12c1d179f32c38a929fcc9adb326a9f44c8288ae (diff)
downloadstred-go-86ee39f44266cb314ab36c4f941377620fc0fead.tar
Remove redundant subex/main.main function
Diffstat (limited to 'subex')
-rw-r--r--subex/main.go49
1 files changed, 0 insertions, 49 deletions
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)
- }
-}