summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-11-23 13:05:49 -0500
committerKyle Gunger <kgunger12@gmail.com>2021-11-23 13:05:49 -0500
commit5eeec21759dc49252ebbcdb5e0d9336f68d0a51e (patch)
treef3b5b759a1f68962a77608e816bbc5d2702ac78b
parent6444b3faef696b044d391b98151ebeb90eb3bb7f (diff)
Some changes, plus a logo.
-rw-r--r--README.md6
-rw-r--r--libtnsl/src/algo/algo.tnsl3
-rw-r--r--libtnsl/src/algo/alloc.tnsl (renamed from libtnsl/src/reflect/dynamic.tnsl)0
-rw-r--r--libtnsl/src/algo/dealloc.tnsl (renamed from libtnsl/src/reflect/method.tnsl)0
-rw-r--r--libtnsl/src/asm/asm.tnsl (renamed from libtnsl/src/reflect/lib.tnsl)9
-rw-r--r--libtnsl/src/bootstrap.tnsl38
-rw-r--r--libtnsl/src/libtnsl.tnsl2
-rw-r--r--libtnsl/src/reflect/dispatch.tnsl (renamed from libtnsl/src/reflect/static.tnsl)0
-rw-r--r--libtnsl/src/reflect/reflect.tnsl6
-rw-r--r--libtnsl/src/reflect/type.tnsl74
-rw-r--r--libtnsl/src/reflect/virtual.tnsl144
-rw-r--r--logo/tnsl-logo.pngbin0 -> 15175 bytes
-rw-r--r--logo/tnsl-logo.svg47
-rw-r--r--spec/4 - fip.md14
-rw-r--r--spec/Appendices.md2
-rw-r--r--tnslc/src/compile/arch/arch.tnsl8
-rw-r--r--tnslc/src/compile/compile.tnsl9
-rw-r--r--tnslc/src/compile/format/format.tnsl20
-rw-r--r--tnslc/src/parse/token.tnsl18
-rw-r--r--tnslc/src/tnslc.tnsl35
20 files changed, 299 insertions, 136 deletions
diff --git a/README.md b/README.md
index b349dea..bf6b363 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,11 @@ The standard TNSL compiler suite. Contains a universal front end for producing
- arm64
- risc-v
-### Status
+## notice
+
+Until the go based interpereter is done, some code may not be correct TNSL code to account for inconsistancies in the bootstrap interpereter. However, the code shouldn't be too far from normal TNSL, the only real difference should be import statements, which will be fixed after the compiler can compile itself.
+
+## Status
Specification: incomplete
libtnsl: incomplete
diff --git a/libtnsl/src/algo/algo.tnsl b/libtnsl/src/algo/algo.tnsl
index 7ddd677..7df9198 100644
--- a/libtnsl/src/algo/algo.tnsl
+++ b/libtnsl/src/algo/algo.tnsl
@@ -21,6 +21,9 @@
/; export module algo
/: include
+ "alloc.tnsl"
+ "dealloc.tnsl"
+
"math"
:/
;/ \ No newline at end of file
diff --git a/libtnsl/src/reflect/dynamic.tnsl b/libtnsl/src/algo/alloc.tnsl
index d346464..d346464 100644
--- a/libtnsl/src/reflect/dynamic.tnsl
+++ b/libtnsl/src/algo/alloc.tnsl
diff --git a/libtnsl/src/reflect/method.tnsl b/libtnsl/src/algo/dealloc.tnsl
index d346464..d346464 100644
--- a/libtnsl/src/reflect/method.tnsl
+++ b/libtnsl/src/algo/dealloc.tnsl
diff --git a/libtnsl/src/reflect/lib.tnsl b/libtnsl/src/asm/asm.tnsl
index 0688e6f..d0da9a6 100644
--- a/libtnsl/src/reflect/lib.tnsl
+++ b/libtnsl/src/asm/asm.tnsl
@@ -19,8 +19,11 @@
EXPRESS OR IMPLIED
#/
-: extern const {}_library _LIB_TABLE
+/## tnsl.asm
-; raw struct _library {
+ Unexported module for internal library use. Bridges
+ the gaps between the main language and assembly for
+ the selected ISA/OS combo.
-} \ No newline at end of file
+#; module asm
+;/ \ No newline at end of file
diff --git a/libtnsl/src/bootstrap.tnsl b/libtnsl/src/bootstrap.tnsl
deleted file mode 100644
index aa36956..0000000
--- a/libtnsl/src/bootstrap.tnsl
+++ /dev/null
@@ -1,38 +0,0 @@
-/##
- Copyright 2021 Kyle Gunger
-
- Dual licensed under the CDDL 1.0 and BSD 3-Clause licenses.
-
- This file may only be used in accordance with one of the two
- licenses. You should have received a copy of each license with
- the source code. In the event that you did not recieve a copy
- of the licenses, they may be found at the following URLs:
-
- CDDL 1.0:
- https://opensource.org/licenses/CDDL-1.0
-
- BSD 3-Clause:
- https://opensource.org/licenses/BSD-3-Clause
-
- THIS SOFTWARE/SOURCE CODE IS PROVIDED "AS IS" WITH NO
- WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE
- EXPRESS OR IMPLIED
-#/
-
-/#
- This file provides a nonstandard entry point for a bootstrap implementation of TNSL.
-
- The reference implementation of the TNSL compiler (written in GOLANG for now), does
- not contain feature complete functionality in the form of pre-compiler directives, which the
- full libts uses for compilation on different operating systems. This version is provided
- so that the reference compiler can produce a functional enough libts to compile the
- full tnslc compiler (written in TNSL).
-
- As such, this entry point must be modified manually to use windows, mac, or linux
- code files, and then will provide a barebones file, stream, and error handeling library
- with nothing else to act as a bootstrap for the compiler. The bootstrap compiler should
- be able to compile the full libts and, in turn, the full compiler.
-#/
-
-/;export module ts
-;/ \ No newline at end of file
diff --git a/libtnsl/src/libtnsl.tnsl b/libtnsl/src/libtnsl.tnsl
index 434e7a4..070bfd2 100644
--- a/libtnsl/src/libtnsl.tnsl
+++ b/libtnsl/src/libtnsl.tnsl
@@ -20,6 +20,8 @@
#/
/;export module tnsl
+ ; const ~void _null = 0x0
+
/: import
"algo"
"box"
diff --git a/libtnsl/src/reflect/static.tnsl b/libtnsl/src/reflect/dispatch.tnsl
index d346464..d346464 100644
--- a/libtnsl/src/reflect/static.tnsl
+++ b/libtnsl/src/reflect/dispatch.tnsl
diff --git a/libtnsl/src/reflect/reflect.tnsl b/libtnsl/src/reflect/reflect.tnsl
index 3c1d583..b3640c2 100644
--- a/libtnsl/src/reflect/reflect.tnsl
+++ b/libtnsl/src/reflect/reflect.tnsl
@@ -24,4 +24,10 @@
Type and method resolution, reflection and other required methods such as is
#; export module reflect
+ /: import
+ "type.tnsl"
+ "virtual.tnsl"
+ "resolver.tnsl"
+ "dispatch.tnsl"
+ :/
;/ \ No newline at end of file
diff --git a/libtnsl/src/reflect/type.tnsl b/libtnsl/src/reflect/type.tnsl
index b36dfc5..7a19b7d 100644
--- a/libtnsl/src/reflect/type.tnsl
+++ b/libtnsl/src/reflect/type.tnsl
@@ -20,53 +20,21 @@
#/
/## tnsl.reflect._type
- Header data which prefixes all non-raw structs.
+ Header data which non-raw structs point to.
Upper limits for classes and libs defined here:
- - Max 2^32 libraries
- - Max 2^16 classes per library
+ - Max 2^16 libraries
+ - Max 2^16 modules/sub-modules per library
+ - Max 2^16 classes per module
- Max 2^8 Generics per class
#/
-; raw struct _type(uint8 N) {
- uint32
- _lib_index,
+; raw struct _type() {
uint16
- _type_index,
+ _library_id,
+ _module_id,
+ _type_id,
- {N}_type
- _generic_list
-}
-
-/## tnsl.reflect._method
- Metadata for methods (can be decoded from library
- symbol tables). Limits for methods defined here:
- - Max 2^8 inputs
- - Max 2^8 outputs
-#/
-; raw struct _method(uint8 I, O) {
- ~{}charp
- name,
-
- {I}_type
- inputs,
- {O}_type
- outputs,
-
- ~void
- address
-}
-
-/## tnsl.reflect._member
- Metadata about struct members
-#/
-; raw struct _member {
- ~{}charp
- name,
-
- uint
- offset,
-
- _type
- _member_type
+ {uint8}_type
+ _generics
}
/## tnsl.reflect._type_addresses
@@ -74,22 +42,30 @@
in a class
#/
; raw struct _type_addresses {
- ~{}uint
- _offsets,
- _super_offsets,
-
~{}_type
_supers,
+
+ ~{}uint
+ _super_offsets,
~{}_method
- _methods
+ _methods,
+
+ ~{}_member
+ _members
}
/; method _type
- /; _is (_type_header base)
+ /; _is (_type base) [bool]
+ ;/
+
+ /; inline _get (_type t, ~void s, _member m) [~void]
+ ;/
+
+ /; inline raw _call (_type t, ~void s, _method m, ~void p)
;/
- /; _get_method ()
+ /; _offset (_type cast) [uint]
;/
;/ \ No newline at end of file
diff --git a/libtnsl/src/reflect/virtual.tnsl b/libtnsl/src/reflect/virtual.tnsl
new file mode 100644
index 0000000..8891905
--- /dev/null
+++ b/libtnsl/src/reflect/virtual.tnsl
@@ -0,0 +1,144 @@
+/##
+ Copyright 2021 Kyle Gunger
+
+ Dual licensed under the CDDL 1.0 and BSD 3-Clause licenses.
+
+ This file may only be used in accordance with one of the two
+ licenses. You should have received a copy of each license with
+ the source code. In the event that you did not recieve a copy
+ of the licenses, they may be found at the following URLs:
+
+ CDDL 1.0:
+ https://opensource.org/licenses/CDDL-1.0
+
+ BSD 3-Clause:
+ https://opensource.org/licenses/BSD-3-Clause
+
+ THIS SOFTWARE/SOURCE CODE IS PROVIDED "AS IS" WITH NO
+ WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE
+ EXPRESS OR IMPLIED
+#/
+
+/## _LIB_TABLE
+ The array of library export trees.
+
+ Convention:
+ - index 0 is always reserved for language-specific types + libtnsl
+ - index 0 module 0 represents the fundimental in-built types like int
+#/
+: extern const {}~library _LIB_TABLE
+
+; raw struct library {
+ # Version
+ uint16
+ major,
+ minor,
+ patch
+
+ ~sym_node
+ root_node
+}
+
+/## tnsl.reflect._method
+ Metadata for methods (can be decoded from library
+ symbol tables). Limits for methods defined here:
+ - Max 2^8 inputs
+ - Max 2^8 outputs
+#/
+; raw struct _method {
+ {uint8}charp
+ name,
+
+ {uint8}~_type
+ inputs,
+ outputs,
+
+ ~void
+ address
+}
+
+/## tnsl.reflect._member
+ Metadata about struct members
+#/
+; raw struct _member {
+ {uint8}charp
+ name,
+
+ _type
+ member_type,
+
+ uint
+ byte_offset
+}
+
+/## tnsl.reflect.sym_node
+ Represents a module in a symbol tree
+#/
+; raw struct sym_node {
+ {uint8}charp
+ name,
+
+ uint16
+ id,
+
+ {}~sym_node
+ sub_modules,
+
+ {}~sym_type
+ sub_types
+}
+
+/## tnsl.reflect.sym_type
+ Represents a type in a symbol tree
+#/
+; raw struct sym_type {
+ {uint8}charp
+ name,
+
+ {uint8}~sym_type
+ super_types,
+
+}
+
+###############################
+# Traverse the Library Tree #
+###############################
+
+/; get_sym_node (~sym_node root, uint16 mod_id) [~sym_node]
+ /;loop (root != null)
+ /; loop (uint16 sub = 0; sub < len `root.sub_modules) [sub++]
+ /; if (mod_id < `root.sub_modules{sub}.id)
+ /; if (sub == 0)
+ ; return null
+ ;/
+ ;root = `root.sub_modules{sub - 1}
+ ; continue 1
+ ;; else if (mod_id == `root.sub_modules{sub}.id)
+ ; return `root.sub_modules{sub}
+ ;/
+ ;/
+
+ ; break
+ ;/
+
+ ; return null
+;/
+
+/; get_sym_node (uint16 lib_id, mod_id) [~sym_node]
+
+ ;~library lib = _LIB_TABLE{lib_id}
+
+ ;return get_sym_node(`lib.root_node, mod_id)
+;/
+
+/; get_sym_type(uint16 lib_id, mod_id, typ_id) [~sym_type]
+
+ ;~library lib = _LIB_TABLE{lib_id}
+ ;~sym_node mod = get_sym_node(`lib.root_node, mod_id)
+
+ ;return `mod.sub_types{typ_id}
+;/
+
+/; get_sym_type(`const {}charp path) [~sym_type]
+
+;/ \ No newline at end of file
diff --git a/logo/tnsl-logo.png b/logo/tnsl-logo.png
new file mode 100644
index 0000000..ff3eb12
--- /dev/null
+++ b/logo/tnsl-logo.png
Binary files differ
diff --git a/logo/tnsl-logo.svg b/logo/tnsl-logo.svg
new file mode 100644
index 0000000..38134c6
--- /dev/null
+++ b/logo/tnsl-logo.svg
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ width="148mm"
+ height="105mm"
+ viewBox="0 0 148 105"
+ version="1.1"
+ id="svg5"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <defs
+ id="defs2" />
+ <g
+ id="layer1">
+ <g
+ aria-label="TNSL"
+ id="text9141"
+ style="font-size:38.1px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.264583;fill:#000000"
+ transform="matrix(1.253945,0,0,1.253945,-13.087415,-6.7420638)">
+ <path
+ d="m 20.904874,33.33842 h 23.496239 v 3.162598 H 34.54125 v 24.61245 h -3.776513 v -24.61245 h -9.859863 z"
+ style="font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';fill:#000000"
+ id="path44035" />
+ <path
+ d="m 48.028798,33.33842 h 5.060156 L 65.404481,56.574211 V 33.33842 H 69.05077 V 61.113468 H 63.990614 L 51.675087,37.877678 v 23.23579 h -3.646289 z"
+ style="font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';fill:#000000"
+ id="path44037" />
+ <path
+ d="m 93.17953,34.249993 v 3.664892 q -2.139405,-1.023193 -4.036963,-1.525488 -1.897559,-0.502295 -3.664893,-0.502295 -3.06958,0 -4.743896,1.190625 -1.655713,1.190625 -1.655713,3.38584 0,1.841748 1.097608,2.790527 1.116211,0.930176 4.204394,1.506885 l 2.269629,0.465087 q 4.204394,0.799952 6.19497,2.827735 2.00918,2.009179 2.00918,5.395019 0,4.036963 -2.716113,6.120556 -2.69751,2.083594 -7.925098,2.083594 -1.971972,0 -4.204394,-0.446484 -2.213818,-0.446485 -4.595068,-1.32085 v -3.869531 q 2.288232,1.283643 4.483447,1.934766 2.195215,0.651123 4.316015,0.651123 3.218408,0 4.967139,-1.265039 1.74873,-1.265039 1.74873,-3.609082 0,-2.046387 -1.265039,-3.199805 -1.246435,-1.153418 -4.111377,-1.730127 l -2.288232,-0.446484 q -4.204394,-0.837158 -6.083349,-2.623096 -1.878955,-1.785937 -1.878955,-4.967138 0,-3.683496 2.585888,-5.804297 2.604492,-2.1208 7.162354,-2.1208 1.953369,0 3.981152,0.353466 2.027783,0.353467 4.148584,1.060401 z"
+ style="font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';fill:#000000"
+ id="path44039" />
+ <path
+ d="m 100.71395,33.33842 h 3.75791 v 24.612451 h 13.52476 v 3.162597 h -17.28267 z"
+ style="font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';fill:#000000"
+ id="path44041" />
+ </g>
+ <path
+ style="fill:#0091ff;fill-opacity:1;stroke:#0091ff;stroke-width:0.344762px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 142.98689,18.191663 c -34.73303,18.565988 -103.240772,18.565988 -137.9737811,0 28.6074191,15.291651 109.3663711,15.291651 137.9737811,0 z"
+ id="path44270-3" />
+ <path
+ style="fill:#0091ff;fill-opacity:1;stroke:#0091ff;stroke-width:0.344762px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 5.0131067,86.80834 C 39.746121,68.242352 108.25388,68.242352 142.98689,86.80834 114.37948,71.516689 33.620527,71.516689 5.0131067,86.80834 Z"
+ id="path44270-3-6" />
+ </g>
+</svg>
diff --git a/spec/4 - fip.md b/spec/4 - fip.md
index dee037c..c5a0259 100644
--- a/spec/4 - fip.md
+++ b/spec/4 - fip.md
@@ -6,19 +6,23 @@ To use higher level features in TNSL, an implimentation of libtnsl must be in pl
## Section 2 - libtnsl and Types
-`libtnsl` has the authority to define how types are stored in memory (to some extent) and how method resolution works on static and dynamic structs. `libtnsl` *must* provide certain methods for some language features to be available. These functions, and their uses are now listed, but a comprehensive list of language keywords can be found in Appendix B.
+`libtnsl` has the authority to define how types are stored in memory (to some extent) and how method resolution works on static and dynamic structs. `libtnsl` *must* provide certain methods for some language features to be available. These functions, and their uses are now listed. A comprehensive list of language keywords can be found in Appendix B.
+
+### 2.0 - nullptr
+
+`tnsl._null` *must* be defined as a universal null pointer value. **No type except pointers may be `null`**, but pointers *must* have a null value to distinguish if they point to a meaningful position in memory.
### 2.1 - The libtnsl Type Extension
`tnsl.reflect._type` *must* be defined as a raw struct which contains minimum information for type identification. This information is stored with every static or dynamic struct so that programs can reflect type information.
-`tnsl.reflect._member` *must* be defined as a raw struct which contains minimum information for member variable identification within a type. The information need not be stored with every member variable, but should be stored somewhere such that the `tnsl.reflect._get` method can make use of it.
+`tnsl.reflect._member` *should* be defined as a raw struct which contains minimum information for member variable identification within a type. The information need not be stored with every member variable, but should be stored somewhere such that the `tnsl.reflect._get` method can make use of it.
`tnsl.reflect._method` *must* be defined as a raw struct which contains minimum information for method identification within a type. The information need not be stored with every member function, but should be stored somewhere such that the `tnsl.reflect._call` method can make use of it.
`tnsl.reflect._is` *must* be defined as a function taking two parameters of type `tnsl.reflect._type` and returning a single `bool` as output. This function is called when the `is` operator is envoked.
-`tnsl.reflect._get` *must* be defined as a function taking three parameters. The first parameter will be of type `tnsl.reflect._type`, the second parameter will be of type `~void`, and the third parameter will be of type `tnsl.reflect._member`. The function will return a single `~void` as output.
+`tnsl.reflect._get` *should* be defined as a function taking three parameters. The first parameter will be of type `tnsl.reflect._type`, the second parameter will be of type `~void`, and the third parameter will be of type `tnsl.reflect._member`. The function will return a single `~void` as output.
In the parameters, the first relates to the type of the struct given, or at least how the callee views the struct. The second is a pointer to the struct itself. The third is the requested member to get. The `~void` returned must point to the requested value.
@@ -34,11 +38,11 @@ In the parameters, the first relates to the type of the struct given, or at leas
`tnsl.algo._dealloc` *must* be defined as a function taking a single parameter of type `~void` as the pointer to a chunk of allocated memory. The function should deallocate the memory.
-### 2.3 - Extra Types Extension
+### 2.3 - Expanded Types Extension
`tnsl.box._vect` *must* be a raw struct which vector or simd instructions can be preformed on.
-`tnsl.box._string` *must* be a raw struct which stores a string of text. This text may be ASCII or Unicode, but reguardless must be stored as `charp` values internally.
+`tnsl.box._string` *must* be a raw struct which stores a string of text. This text may be ASCII or Unicode, and should be stored as `charp` values internally.
## Section 3 - Cross calling C
diff --git a/spec/Appendices.md b/spec/Appendices.md
index 1caccc7..cd161e9 100644
--- a/spec/Appendices.md
+++ b/spec/Appendices.md
@@ -201,6 +201,8 @@
len - size (in elements) of an array
+ null - represents a broken pointer. This value only has context for pointers and is defined as a ~void.
+
User defined types:
diff --git a/tnslc/src/compile/arch/arch.tnsl b/tnslc/src/compile/arch/arch.tnsl
index bcabbfa..5e81673 100644
--- a/tnslc/src/compile/arch/arch.tnsl
+++ b/tnslc/src/compile/arch/arch.tnsl
@@ -14,9 +14,7 @@
EXPRESS OR IMPLIED
#/
-/; export module arch
- :import "common.tnsl"
- :import "isa_arm.tnsl"
- :import "isa_risc_v.tnsl"
- :import "isa_x86.tnsl"
+/; module arch
+ :import "compile/arch/common.tnsl"
+ :import "compile/arch/isa_x86.tnsl"
;/ \ No newline at end of file
diff --git a/tnslc/src/compile/compile.tnsl b/tnslc/src/compile/compile.tnsl
index 0fef36c..263dc59 100644
--- a/tnslc/src/compile/compile.tnsl
+++ b/tnslc/src/compile/compile.tnsl
@@ -14,9 +14,8 @@
EXPRESS OR IMPLIED
#/
-/; export module compile
- /: include
- "arch"
- "format"
- :/
+/; module compile
+ :include "compile/arch/arch.tnsl"
+ :include "compile/format/format.tnsl"
+
;/
diff --git a/tnslc/src/compile/format/format.tnsl b/tnslc/src/compile/format/format.tnsl
index e69de29..2d4ed4b 100644
--- a/tnslc/src/compile/format/format.tnsl
+++ b/tnslc/src/compile/format/format.tnsl
@@ -0,0 +1,20 @@
+/##
+ Copyright 2021 Kyle Gunger
+
+ This file is licensed under the CDDL 1.0 (the License)
+ and may only be used in accordance with the License.
+ You should have received a copy of the License with this
+ software/source code. If you did not, a copy can be found
+ at the following URL:
+
+ https://opensource.org/licenses/CDDL-1.0
+
+ THIS SOFTWARE/SOURCE CODE IS PROVIDED "AS IS" WITH NO
+ WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE
+ EXPRESS OR IMPLIED
+#/
+
+/; module format
+ :include "compile/format/out.tnsl"
+ :include "compile/format/elf.tnsl"
+;/ \ No newline at end of file
diff --git a/tnslc/src/parse/token.tnsl b/tnslc/src/parse/token.tnsl
index cbbb31f..21abe7b 100644
--- a/tnslc/src/parse/token.tnsl
+++ b/tnslc/src/parse/token.tnsl
@@ -41,14 +41,14 @@
/; method Token
/; operator delete
- ;delete this.data
+ ;delete self.data
;/
- /; add_char (`{}charp part)
- ;uint l = len `this.data
- ;realloc this.data, l + len part
- /;loop (uint i = 0; i < len part) [i++]
- `this.data{l + i} = part{i}
+ /; add_char (~{}charp part)
+ ;uint l = len self.data`
+ ;realloc self.data, l + len part
+ /;loop (uint i = 0) [i++; i < len part]
+ ;self.data`{l + i} = part{i}
;/
;/
;/
@@ -212,7 +212,7 @@
/##
Checks if the character point p is in the string cmp
-#; is_in_string (`const {}charp cmp, charp p) [bool]
+#; is_in_string (const {}charp` cmp, charp p) [bool]
/; loop (int i = 0; i < len cmp) [i++]
@@ -228,7 +228,7 @@
/##
Checks if the string s is in the list cmp
-#; is_in_string_list (`const {}{}charp cmp, `{}charp s) [bool]
+#; is_in_string_list (const {}{}charp` cmp, {}charp` s) [bool]
/; loop (int i = 0; i < len cmp) [i++]
@@ -253,7 +253,7 @@
/#
Get the token_type value for a given string of character points
-#; get_token_type (`{}charp s) [int]
+#; get_token_type ({}charp` s) [int]
/; if (len s > 1)
diff --git a/tnslc/src/tnslc.tnsl b/tnslc/src/tnslc.tnsl
index 617e9e7..212819e 100644
--- a/tnslc/src/tnslc.tnsl
+++ b/tnslc/src/tnslc.tnsl
@@ -14,32 +14,25 @@
EXPRESS OR IMPLIED
#/
-/; export module tnslc
- :import "flags"
- :import "parse"
- :import "ast"
- :import "compile"
+/; module tnslc
+ :import "flags/flags.tnsl"
+ :import "parse/parse.tnsl"
+ :import "ast/ast.tnsl"
+ :import "compile/compile.tnsl"
;/
-:using 'tnsl'
-:using 'tnslc'
/; main (~{}{}char args) [int]
- ;var arg_list = flags.parse(args)
+ ;tnslc.flags.Flags argList = tnslc.flags.parse(args)
- ;var token_list = parse.tokenize(arg_list)
+ ;{}tnslc.parse.Token tokenList = tnslc.parse.tokenize(argList)
- ;var ast = ast.generate(token_list)
+ ;tnslc.ast.Node ast = ast.generate(tokenList)
- /; try
- ;var out_file = file.open(arg_list.output_file_path)
- ;var data = compile.generate(arg_list, ast)
-
- ;out_file.write(data)
- ;out_file.close()
+ ;tnsl.io.File outFile = tnsl.io.open_file(argList.outPath)
+ ;[]uint8 data = tnslc.compile.generate(argList, ast)
+
+ ;outFile.write(data)
- ;; catch (error e)
- ;io.stdout.write(e.msg)
- ;return e.code
- ;/
-;/ \ No newline at end of file
+ ;outFile.close()
+;/