summaryrefslogtreecommitdiff
path: root/src/texec
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-11-01 02:22:29 -0400
committerKyle Gunger <kgunger12@gmail.com>2021-11-01 02:22:29 -0400
commit705d62fdf1752e94df2071fdea16b41a124a15e6 (patch)
tree62b0920cc4b70d2f3d2f9504a796abdb89a41e58 /src/texec
parent25e716cd730992baae64d7906b1d7eb5119f9d19 (diff)
[EXEC] Initialize
+ Some initial files for use in the interpreter
Diffstat (limited to 'src/texec')
-rw-r--r--src/texec/libtnsl.go23
-rw-r--r--src/texec/world.go50
-rw-r--r--src/texec/worldbuilder.go24
3 files changed, 97 insertions, 0 deletions
diff --git a/src/texec/libtnsl.go b/src/texec/libtnsl.go
new file mode 100644
index 0000000..c77bd25
--- /dev/null
+++ b/src/texec/libtnsl.go
@@ -0,0 +1,23 @@
+/*
+ Copyright 2020 Kyle Gunger
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package texec
+
+/**
+ This file represents the 'tnsl' module and a key few functions.
+ These functions should be all that is needed to use the compiler, and no more.
+*/
+
diff --git a/src/texec/world.go b/src/texec/world.go
new file mode 100644
index 0000000..7f51c13
--- /dev/null
+++ b/src/texec/world.go
@@ -0,0 +1,50 @@
+/*
+ Copyright 2020 Kyle Gunger
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package texec
+
+// TVaraiable represents a single variable in the program
+type TVariable struct {
+ Type string
+ Data interface{}
+}
+
+// TPath represents a pointer to the current module and file
+// that the thread is working in.
+type TPath struct {
+ module []string,
+ file string
+}
+
+// TContext represents a single thread.
+type TContext struct {
+ CallStack []Node,
+ VarMap []map[string]TVariable
+}
+
+// TModule represents a collection of files and sub-modules in a program
+type Module struct {
+ Files []Node,
+ Globals []map[string]TVariable
+ Sub []TModule
+}
+
+// TWorld represents the full program
+type TWorld struct {
+ Modules []TModule,
+ MainPath TPath,
+ MainFunc Node
+} \ No newline at end of file
diff --git a/src/texec/worldbuilder.go b/src/texec/worldbuilder.go
new file mode 100644
index 0000000..37f05db
--- /dev/null
+++ b/src/texec/worldbuilder.go
@@ -0,0 +1,24 @@
+/*
+ Copyright 2020 Kyle Gunger
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package texec
+
+import "tparse"
+
+/**
+ worldbuilder.go - take in a file name and construct a TWorld based on it.
+*/
+