diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/exec.go | 4 | ||||
-rw-r--r-- | src/texec/eval.go | 7 | ||||
-rw-r--r-- | src/texec/world.go | 7 | ||||
-rw-r--r-- | src/texec/worldbuilder.go | 35 | ||||
-rw-r--r-- | src/tparse/tree-statement.go | 4 |
5 files changed, 43 insertions, 14 deletions
diff --git a/src/exec.go b/src/exec.go index 79584ce..b9a74f8 100644 --- a/src/exec.go +++ b/src/exec.go @@ -26,7 +26,7 @@ func main() { flag.Parse() - world := texec.BuildWorld(*inputFile) + root := texec.BuildRoot(*inputFile) - texec.EvalTNSL(world, *progFlags) + texec.EvalTNSL(&root, *progFlags) }
\ No newline at end of file diff --git a/src/texec/eval.go b/src/texec/eval.go index 9d2e64d..f863c5d 100644 --- a/src/texec/eval.go +++ b/src/texec/eval.go @@ -17,8 +17,13 @@ package texec import "strings" +import "tparse" + +func isMain(artifact tparse.Node) bool { + return false +} // EvalTNSL starts the evaluation on the World's main function with the given flags passed to the program -func EvalTNSL(world *TWorld, f string) { +func EvalTNSL(world *TModule, f string) { flags := strings.Split(f, " ") }
\ No newline at end of file diff --git a/src/texec/world.go b/src/texec/world.go index d87119d..86660bc 100644 --- a/src/texec/world.go +++ b/src/texec/world.go @@ -40,14 +40,9 @@ type TContext struct { // TModule represents a collection of files and sub-modules in a program type TModule struct { + Name string Files []tparse.Node Globals []map[string]TVariable Sub []TModule } -// TWorld represents the full program -type TWorld struct { - Modules []TModule - MainPath TPath - MainFunc tparse.Node -} diff --git a/src/texec/worldbuilder.go b/src/texec/worldbuilder.go index 8e5648f..e0fefa4 100644 --- a/src/texec/worldbuilder.go +++ b/src/texec/worldbuilder.go @@ -30,7 +30,36 @@ func parseFile(p string) tparse.Node { return tparse.MakeTree(&(tokens), p) } -// BuildWorld creates a new TWorld by parsing a main file and recursively parsing imports. -func BuildWorld(file string) TWorld { - return nil +func buildModule(module tparse.Node) TModule { + out := TModule{} + + for n := 0 ; n < len(module.Sub) ; n++ { + + switch module.Sub[n].Data.Type { + case 11: + + case 10: + + } + } + + return out +} + +// BuildRoot builds the root module, ready for eval +func BuildRoot(file tparse.Node) TModule { + out := TModule{} + + out.Files = append(out.Files, file) + + for n := 0 ; n < len(file.Sub) ; n++ { + + switch file.Sub[n].Data.Type { + case 11: + + case 10: + } + } + + return out } diff --git a/src/tparse/tree-statement.go b/src/tparse/tree-statement.go index 897f30d..ec6230c 100644 --- a/src/tparse/tree-statement.go +++ b/src/tparse/tree-statement.go @@ -146,7 +146,7 @@ func parseBlock(tokens *[]Token, tok, max int) (Node, int) { // This should work once isTypeThenValue properly functions func parseStatement(tokens *[]Token, tok, max int) (Node, int) { out := Node{} - out.Data = Token{Type: 11, Data: "value"} + out.Data = Token{Type: 10, Data: "value"} var tmp Node // Check for keyword, definition, then if none of those apply, assume it's a value. @@ -262,7 +262,7 @@ func keywordStatement(tokens *[]Token, tok, max int) (Node, int) { // Should work, but none of this is tested. func parseDef(tokens *[]Token, tok, max int) (Node, int) { - out := Node{Data: Token{11, "define", 0, 0}} + out := Node{Data: Token{10, "define", 0, 0}} var tmp Node tmp, tok = parseType(tokens, tok, max, false) |