From d0213b4202ac12d7e92f7125e87c31d9ecb637dd Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Mon, 11 Apr 2022 18:50:08 -0400 Subject: Remove src folders --- libtnsl/algo/algo.tnsl | 29 ++++ libtnsl/algo/alloc.tnsl | 20 +++ libtnsl/algo/dealloc.tnsl | 20 +++ libtnsl/algo/math/math.tnsl | 26 +++ libtnsl/asm/asm.tnsl | 29 ++++ libtnsl/box/box.tnsl | 34 ++++ libtnsl/box/iterator.tnsl | 40 +++++ libtnsl/box/map.tnsl | 20 +++ libtnsl/box/string.tnsl | 20 +++ libtnsl/box/tree.tnsl | 20 +++ libtnsl/box/vector.tnsl | 20 +++ libtnsl/io/block.tnsl | 20 +++ libtnsl/io/file.tnsl | 20 +++ libtnsl/io/io.tnsl | 33 ++++ libtnsl/io/std.tnsl | 20 +++ libtnsl/io/stream.tnsl | 20 +++ libtnsl/libtnsl.tnsl | 32 ++++ libtnsl/reflect/dispatch.tnsl | 20 +++ libtnsl/reflect/reflect.tnsl | 33 ++++ libtnsl/reflect/resolver.tnsl | 20 +++ libtnsl/reflect/type.tnsl | 71 ++++++++ libtnsl/reflect/virtual.tnsl | 144 ++++++++++++++++ libtnsl/src/algo/algo.tnsl | 29 ---- libtnsl/src/algo/alloc.tnsl | 20 --- libtnsl/src/algo/dealloc.tnsl | 20 --- libtnsl/src/algo/math/math.tnsl | 26 --- libtnsl/src/asm/asm.tnsl | 29 ---- libtnsl/src/box/box.tnsl | 34 ---- libtnsl/src/box/iterator.tnsl | 40 ----- libtnsl/src/box/map.tnsl | 20 --- libtnsl/src/box/string.tnsl | 20 --- libtnsl/src/box/tree.tnsl | 20 --- libtnsl/src/box/vector.tnsl | 20 --- libtnsl/src/io/block.tnsl | 20 --- libtnsl/src/io/file.tnsl | 20 --- libtnsl/src/io/io.tnsl | 33 ---- libtnsl/src/io/std.tnsl | 20 --- libtnsl/src/io/stream.tnsl | 20 --- libtnsl/src/libtnsl.tnsl | 32 ---- libtnsl/src/reflect/dispatch.tnsl | 20 --- libtnsl/src/reflect/reflect.tnsl | 33 ---- libtnsl/src/reflect/resolver.tnsl | 20 --- libtnsl/src/reflect/type.tnsl | 71 -------- libtnsl/src/reflect/virtual.tnsl | 144 ---------------- libtnsl/src/time/alg.tnsl | 20 --- libtnsl/src/time/conv.tnsl | 20 --- libtnsl/src/time/parse.tnsl | 20 --- libtnsl/src/time/time.tnsl | 27 --- libtnsl/time/alg.tnsl | 20 +++ libtnsl/time/conv.tnsl | 20 +++ libtnsl/time/parse.tnsl | 20 +++ libtnsl/time/time.tnsl | 27 +++ spec/1.md | 4 +- tnslc/ast/ast.tnsl | 19 +++ tnslc/ast/node.tnsl | 85 ++++++++++ tnslc/compile/arch/arch.tnsl | 20 +++ tnslc/compile/arch/common.tnsl | 17 ++ tnslc/compile/arch/isa_arm.tnsl | 15 ++ tnslc/compile/arch/isa_risc_v.tnsl | 15 ++ tnslc/compile/arch/isa_x86.tnsl | 15 ++ tnslc/compile/compile.tnsl | 21 +++ tnslc/compile/format/elf.tnsl | 151 +++++++++++++++++ tnslc/compile/format/format.tnsl | 20 +++ tnslc/compile/format/iex.tnsl | 0 tnslc/compile/format/out.tnsl | 0 tnslc/compile/format/pe.tnsl | 0 tnslc/flags/flags.tnsl | 16 ++ tnslc/parse/parse.tnsl | 20 +++ tnslc/parse/token.tnsl | 295 +++++++++++++++++++++++++++++++++ tnslc/parse/tokenizer.tnsl | 53 ++++++ tnslc/src/ast/ast.tnsl | 19 --- tnslc/src/ast/node.tnsl | 85 ---------- tnslc/src/compile/arch/arch.tnsl | 20 --- tnslc/src/compile/arch/common.tnsl | 17 -- tnslc/src/compile/arch/isa_arm.tnsl | 15 -- tnslc/src/compile/arch/isa_risc_v.tnsl | 15 -- tnslc/src/compile/arch/isa_x86.tnsl | 15 -- tnslc/src/compile/compile.tnsl | 21 --- tnslc/src/compile/format/elf.tnsl | 151 ----------------- tnslc/src/compile/format/format.tnsl | 20 --- tnslc/src/compile/format/iex.tnsl | 0 tnslc/src/compile/format/out.tnsl | 0 tnslc/src/compile/format/pe.tnsl | 0 tnslc/src/flags/flags.tnsl | 16 -- tnslc/src/parse/parse.tnsl | 22 --- tnslc/src/parse/token.tnsl | 295 --------------------------------- tnslc/src/parse/tokenizer.tnsl | 38 ----- tnslc/src/tnslc.tnsl | 38 ----- tnslc/tnslc.tnsl | 41 +++++ 89 files changed, 1603 insertions(+), 1587 deletions(-) create mode 100644 libtnsl/algo/algo.tnsl create mode 100644 libtnsl/algo/alloc.tnsl create mode 100644 libtnsl/algo/dealloc.tnsl create mode 100644 libtnsl/algo/math/math.tnsl create mode 100644 libtnsl/asm/asm.tnsl create mode 100644 libtnsl/box/box.tnsl create mode 100644 libtnsl/box/iterator.tnsl create mode 100644 libtnsl/box/map.tnsl create mode 100644 libtnsl/box/string.tnsl create mode 100644 libtnsl/box/tree.tnsl create mode 100644 libtnsl/box/vector.tnsl create mode 100644 libtnsl/io/block.tnsl create mode 100644 libtnsl/io/file.tnsl create mode 100644 libtnsl/io/io.tnsl create mode 100644 libtnsl/io/std.tnsl create mode 100644 libtnsl/io/stream.tnsl create mode 100644 libtnsl/libtnsl.tnsl create mode 100644 libtnsl/reflect/dispatch.tnsl create mode 100644 libtnsl/reflect/reflect.tnsl create mode 100644 libtnsl/reflect/resolver.tnsl create mode 100644 libtnsl/reflect/type.tnsl create mode 100644 libtnsl/reflect/virtual.tnsl delete mode 100644 libtnsl/src/algo/algo.tnsl delete mode 100644 libtnsl/src/algo/alloc.tnsl delete mode 100644 libtnsl/src/algo/dealloc.tnsl delete mode 100644 libtnsl/src/algo/math/math.tnsl delete mode 100644 libtnsl/src/asm/asm.tnsl delete mode 100644 libtnsl/src/box/box.tnsl delete mode 100644 libtnsl/src/box/iterator.tnsl delete mode 100644 libtnsl/src/box/map.tnsl delete mode 100644 libtnsl/src/box/string.tnsl delete mode 100644 libtnsl/src/box/tree.tnsl delete mode 100644 libtnsl/src/box/vector.tnsl delete mode 100644 libtnsl/src/io/block.tnsl delete mode 100644 libtnsl/src/io/file.tnsl delete mode 100644 libtnsl/src/io/io.tnsl delete mode 100644 libtnsl/src/io/std.tnsl delete mode 100644 libtnsl/src/io/stream.tnsl delete mode 100644 libtnsl/src/libtnsl.tnsl delete mode 100644 libtnsl/src/reflect/dispatch.tnsl delete mode 100644 libtnsl/src/reflect/reflect.tnsl delete mode 100644 libtnsl/src/reflect/resolver.tnsl delete mode 100644 libtnsl/src/reflect/type.tnsl delete mode 100644 libtnsl/src/reflect/virtual.tnsl delete mode 100644 libtnsl/src/time/alg.tnsl delete mode 100644 libtnsl/src/time/conv.tnsl delete mode 100644 libtnsl/src/time/parse.tnsl delete mode 100644 libtnsl/src/time/time.tnsl create mode 100644 libtnsl/time/alg.tnsl create mode 100644 libtnsl/time/conv.tnsl create mode 100644 libtnsl/time/parse.tnsl create mode 100644 libtnsl/time/time.tnsl create mode 100644 tnslc/ast/ast.tnsl create mode 100644 tnslc/ast/node.tnsl create mode 100644 tnslc/compile/arch/arch.tnsl create mode 100644 tnslc/compile/arch/common.tnsl create mode 100644 tnslc/compile/arch/isa_arm.tnsl create mode 100644 tnslc/compile/arch/isa_risc_v.tnsl create mode 100644 tnslc/compile/arch/isa_x86.tnsl create mode 100644 tnslc/compile/compile.tnsl create mode 100644 tnslc/compile/format/elf.tnsl create mode 100644 tnslc/compile/format/format.tnsl create mode 100644 tnslc/compile/format/iex.tnsl create mode 100644 tnslc/compile/format/out.tnsl create mode 100644 tnslc/compile/format/pe.tnsl create mode 100644 tnslc/flags/flags.tnsl create mode 100644 tnslc/parse/parse.tnsl create mode 100644 tnslc/parse/token.tnsl create mode 100644 tnslc/parse/tokenizer.tnsl delete mode 100644 tnslc/src/ast/ast.tnsl delete mode 100644 tnslc/src/ast/node.tnsl delete mode 100644 tnslc/src/compile/arch/arch.tnsl delete mode 100644 tnslc/src/compile/arch/common.tnsl delete mode 100644 tnslc/src/compile/arch/isa_arm.tnsl delete mode 100644 tnslc/src/compile/arch/isa_risc_v.tnsl delete mode 100644 tnslc/src/compile/arch/isa_x86.tnsl delete mode 100644 tnslc/src/compile/compile.tnsl delete mode 100644 tnslc/src/compile/format/elf.tnsl delete mode 100644 tnslc/src/compile/format/format.tnsl delete mode 100644 tnslc/src/compile/format/iex.tnsl delete mode 100644 tnslc/src/compile/format/out.tnsl delete mode 100644 tnslc/src/compile/format/pe.tnsl delete mode 100644 tnslc/src/flags/flags.tnsl delete mode 100644 tnslc/src/parse/parse.tnsl delete mode 100644 tnslc/src/parse/token.tnsl delete mode 100644 tnslc/src/parse/tokenizer.tnsl delete mode 100644 tnslc/src/tnslc.tnsl create mode 100644 tnslc/tnslc.tnsl diff --git a/libtnsl/algo/algo.tnsl b/libtnsl/algo/algo.tnsl new file mode 100644 index 0000000..7df9198 --- /dev/null +++ b/libtnsl/algo/algo.tnsl @@ -0,0 +1,29 @@ +/## + 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 +#/ + +/; export module algo + /: include + "alloc.tnsl" + "dealloc.tnsl" + + "math" + :/ +;/ \ No newline at end of file diff --git a/libtnsl/algo/alloc.tnsl b/libtnsl/algo/alloc.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/algo/alloc.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/algo/dealloc.tnsl b/libtnsl/algo/dealloc.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/algo/dealloc.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/algo/math/math.tnsl b/libtnsl/algo/math/math.tnsl new file mode 100644 index 0000000..5676d09 --- /dev/null +++ b/libtnsl/algo/math/math.tnsl @@ -0,0 +1,26 @@ +/## + 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 +#/ + +/; export module math + /; include + + ;/ +;/ \ No newline at end of file diff --git a/libtnsl/asm/asm.tnsl b/libtnsl/asm/asm.tnsl new file mode 100644 index 0000000..d0da9a6 --- /dev/null +++ b/libtnsl/asm/asm.tnsl @@ -0,0 +1,29 @@ +/## + 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 +#/ + +/## tnsl.asm + + Unexported module for internal library use. Bridges + the gaps between the main language and assembly for + the selected ISA/OS combo. + +#; module asm +;/ \ No newline at end of file diff --git a/libtnsl/box/box.tnsl b/libtnsl/box/box.tnsl new file mode 100644 index 0000000..2f270b6 --- /dev/null +++ b/libtnsl/box/box.tnsl @@ -0,0 +1,34 @@ +/## + 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 +#/ + +/## + module tnsl.box + Containers and data management classes + +#; export module box + /: import + "iterator.tnsl" + "map.tnsl" + "string.tnsl" + "tree.tnsl" + "vector.tnsl" + :/ +;/ \ No newline at end of file diff --git a/libtnsl/box/iterator.tnsl b/libtnsl/box/iterator.tnsl new file mode 100644 index 0000000..13b9ef9 --- /dev/null +++ b/libtnsl/box/iterator.tnsl @@ -0,0 +1,40 @@ +/## + 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 +#/ + +# Interface for moving through a list +/; interface ForwardsIterator (type T) + + # Advance to the next element in the list + /; next [bool] + ;/ + + # Get the current element in the list + /; current [T] + ;/ +;/ + +# Interface for moving through a list forwards or backwards +/; interface TwoWayIterator (type T) extends ForwardsIterator(T) + + # Move to the previous element in the list + /; prev [bool] + ;/ +;/ \ No newline at end of file diff --git a/libtnsl/box/map.tnsl b/libtnsl/box/map.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/box/map.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/box/string.tnsl b/libtnsl/box/string.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/box/string.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/box/tree.tnsl b/libtnsl/box/tree.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/box/tree.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/box/vector.tnsl b/libtnsl/box/vector.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/box/vector.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/io/block.tnsl b/libtnsl/io/block.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/io/block.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/io/file.tnsl b/libtnsl/io/file.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/io/file.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/io/io.tnsl b/libtnsl/io/io.tnsl new file mode 100644 index 0000000..68e2fc0 --- /dev/null +++ b/libtnsl/io/io.tnsl @@ -0,0 +1,33 @@ +/## + 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 +#/ + +/## + module tnsl.io + Data management for input and output via blocks and streams, memory tools such as alloc and delete + +#; export module io + /: import + "block.tnsl" + "stream.tnsl" + "file.tnsl" + "std.tnsl" + :/ +;/ \ No newline at end of file diff --git a/libtnsl/io/std.tnsl b/libtnsl/io/std.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/io/std.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/io/stream.tnsl b/libtnsl/io/stream.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/io/stream.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/libtnsl.tnsl b/libtnsl/libtnsl.tnsl new file mode 100644 index 0000000..070bfd2 --- /dev/null +++ b/libtnsl/libtnsl.tnsl @@ -0,0 +1,32 @@ +/## + 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 +#/ + +/;export module tnsl + ; const ~void _null = 0x0 + + /: import + "algo" + "box" + "io" + "reflect" + "time" + :/ +;/ \ No newline at end of file diff --git a/libtnsl/reflect/dispatch.tnsl b/libtnsl/reflect/dispatch.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/reflect/dispatch.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/reflect/reflect.tnsl b/libtnsl/reflect/reflect.tnsl new file mode 100644 index 0000000..b3640c2 --- /dev/null +++ b/libtnsl/reflect/reflect.tnsl @@ -0,0 +1,33 @@ +/## + 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 +#/ + +/## + module tnsl.reflect + 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/reflect/resolver.tnsl b/libtnsl/reflect/resolver.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/reflect/resolver.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/reflect/type.tnsl b/libtnsl/reflect/type.tnsl new file mode 100644 index 0000000..7a19b7d --- /dev/null +++ b/libtnsl/reflect/type.tnsl @@ -0,0 +1,71 @@ +/## + 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 +#/ + +/## tnsl.reflect._type + Header data which non-raw structs point to. + Upper limits for classes and libs defined here: + - 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() { + uint16 + _library_id, + _module_id, + _type_id, + + {uint8}_type + _generics +} + +/## tnsl.reflect._type_addresses + Metadata about where things are stored + in a class +#/ +; raw struct _type_addresses { + ~{}_type + _supers, + + ~{}uint + _super_offsets, + + ~{}_method + _methods, + + ~{}_member + _members +} + +/; method _type + + /; _is (_type base) [bool] + ;/ + + /; inline _get (_type t, ~void s, _member m) [~void] + ;/ + + /; inline raw _call (_type t, ~void s, _method m, ~void p) + ;/ + + /; _offset (_type cast) [uint] + ;/ +;/ \ No newline at end of file diff --git a/libtnsl/reflect/virtual.tnsl b/libtnsl/reflect/virtual.tnsl new file mode 100644 index 0000000..8891905 --- /dev/null +++ b/libtnsl/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/libtnsl/src/algo/algo.tnsl b/libtnsl/src/algo/algo.tnsl deleted file mode 100644 index 7df9198..0000000 --- a/libtnsl/src/algo/algo.tnsl +++ /dev/null @@ -1,29 +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 -#/ - -/; export module algo - /: include - "alloc.tnsl" - "dealloc.tnsl" - - "math" - :/ -;/ \ No newline at end of file diff --git a/libtnsl/src/algo/alloc.tnsl b/libtnsl/src/algo/alloc.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/algo/alloc.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/algo/dealloc.tnsl b/libtnsl/src/algo/dealloc.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/algo/dealloc.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/algo/math/math.tnsl b/libtnsl/src/algo/math/math.tnsl deleted file mode 100644 index 5676d09..0000000 --- a/libtnsl/src/algo/math/math.tnsl +++ /dev/null @@ -1,26 +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 -#/ - -/; export module math - /; include - - ;/ -;/ \ No newline at end of file diff --git a/libtnsl/src/asm/asm.tnsl b/libtnsl/src/asm/asm.tnsl deleted file mode 100644 index d0da9a6..0000000 --- a/libtnsl/src/asm/asm.tnsl +++ /dev/null @@ -1,29 +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 -#/ - -/## tnsl.asm - - Unexported module for internal library use. Bridges - the gaps between the main language and assembly for - the selected ISA/OS combo. - -#; module asm -;/ \ No newline at end of file diff --git a/libtnsl/src/box/box.tnsl b/libtnsl/src/box/box.tnsl deleted file mode 100644 index 2f270b6..0000000 --- a/libtnsl/src/box/box.tnsl +++ /dev/null @@ -1,34 +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 -#/ - -/## - module tnsl.box - Containers and data management classes - -#; export module box - /: import - "iterator.tnsl" - "map.tnsl" - "string.tnsl" - "tree.tnsl" - "vector.tnsl" - :/ -;/ \ No newline at end of file diff --git a/libtnsl/src/box/iterator.tnsl b/libtnsl/src/box/iterator.tnsl deleted file mode 100644 index 13b9ef9..0000000 --- a/libtnsl/src/box/iterator.tnsl +++ /dev/null @@ -1,40 +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 -#/ - -# Interface for moving through a list -/; interface ForwardsIterator (type T) - - # Advance to the next element in the list - /; next [bool] - ;/ - - # Get the current element in the list - /; current [T] - ;/ -;/ - -# Interface for moving through a list forwards or backwards -/; interface TwoWayIterator (type T) extends ForwardsIterator(T) - - # Move to the previous element in the list - /; prev [bool] - ;/ -;/ \ No newline at end of file diff --git a/libtnsl/src/box/map.tnsl b/libtnsl/src/box/map.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/box/map.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/box/string.tnsl b/libtnsl/src/box/string.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/box/string.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/box/tree.tnsl b/libtnsl/src/box/tree.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/box/tree.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/box/vector.tnsl b/libtnsl/src/box/vector.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/box/vector.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/io/block.tnsl b/libtnsl/src/io/block.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/io/block.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/io/file.tnsl b/libtnsl/src/io/file.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/io/file.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/io/io.tnsl b/libtnsl/src/io/io.tnsl deleted file mode 100644 index 68e2fc0..0000000 --- a/libtnsl/src/io/io.tnsl +++ /dev/null @@ -1,33 +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 -#/ - -/## - module tnsl.io - Data management for input and output via blocks and streams, memory tools such as alloc and delete - -#; export module io - /: import - "block.tnsl" - "stream.tnsl" - "file.tnsl" - "std.tnsl" - :/ -;/ \ No newline at end of file diff --git a/libtnsl/src/io/std.tnsl b/libtnsl/src/io/std.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/io/std.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/io/stream.tnsl b/libtnsl/src/io/stream.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/io/stream.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/libtnsl.tnsl b/libtnsl/src/libtnsl.tnsl deleted file mode 100644 index 070bfd2..0000000 --- a/libtnsl/src/libtnsl.tnsl +++ /dev/null @@ -1,32 +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 -#/ - -/;export module tnsl - ; const ~void _null = 0x0 - - /: import - "algo" - "box" - "io" - "reflect" - "time" - :/ -;/ \ No newline at end of file diff --git a/libtnsl/src/reflect/dispatch.tnsl b/libtnsl/src/reflect/dispatch.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/reflect/dispatch.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/reflect/reflect.tnsl b/libtnsl/src/reflect/reflect.tnsl deleted file mode 100644 index b3640c2..0000000 --- a/libtnsl/src/reflect/reflect.tnsl +++ /dev/null @@ -1,33 +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 -#/ - -/## - module tnsl.reflect - 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/resolver.tnsl b/libtnsl/src/reflect/resolver.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/reflect/resolver.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/reflect/type.tnsl b/libtnsl/src/reflect/type.tnsl deleted file mode 100644 index 7a19b7d..0000000 --- a/libtnsl/src/reflect/type.tnsl +++ /dev/null @@ -1,71 +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 -#/ - -/## tnsl.reflect._type - Header data which non-raw structs point to. - Upper limits for classes and libs defined here: - - 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() { - uint16 - _library_id, - _module_id, - _type_id, - - {uint8}_type - _generics -} - -/## tnsl.reflect._type_addresses - Metadata about where things are stored - in a class -#/ -; raw struct _type_addresses { - ~{}_type - _supers, - - ~{}uint - _super_offsets, - - ~{}_method - _methods, - - ~{}_member - _members -} - -/; method _type - - /; _is (_type base) [bool] - ;/ - - /; inline _get (_type t, ~void s, _member m) [~void] - ;/ - - /; inline raw _call (_type t, ~void s, _method m, ~void p) - ;/ - - /; _offset (_type cast) [uint] - ;/ -;/ \ No newline at end of file diff --git a/libtnsl/src/reflect/virtual.tnsl b/libtnsl/src/reflect/virtual.tnsl deleted file mode 100644 index 8891905..0000000 --- a/libtnsl/src/reflect/virtual.tnsl +++ /dev/null @@ -1,144 +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 -#/ - -/## _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/libtnsl/src/time/alg.tnsl b/libtnsl/src/time/alg.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/time/alg.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/time/conv.tnsl b/libtnsl/src/time/conv.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/time/conv.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/time/parse.tnsl b/libtnsl/src/time/parse.tnsl deleted file mode 100644 index d346464..0000000 --- a/libtnsl/src/time/parse.tnsl +++ /dev/null @@ -1,20 +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 -#/ \ No newline at end of file diff --git a/libtnsl/src/time/time.tnsl b/libtnsl/src/time/time.tnsl deleted file mode 100644 index dc24369..0000000 --- a/libtnsl/src/time/time.tnsl +++ /dev/null @@ -1,27 +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 -#/ - -/## - module tnsl.time - Functionality for conversion, parsing, printing, and measuring of time - -#; export module time -;/ \ No newline at end of file diff --git a/libtnsl/time/alg.tnsl b/libtnsl/time/alg.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/time/alg.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/time/conv.tnsl b/libtnsl/time/conv.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/time/conv.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/time/parse.tnsl b/libtnsl/time/parse.tnsl new file mode 100644 index 0000000..d346464 --- /dev/null +++ b/libtnsl/time/parse.tnsl @@ -0,0 +1,20 @@ +/## + 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 +#/ \ No newline at end of file diff --git a/libtnsl/time/time.tnsl b/libtnsl/time/time.tnsl new file mode 100644 index 0000000..dc24369 --- /dev/null +++ b/libtnsl/time/time.tnsl @@ -0,0 +1,27 @@ +/## + 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 +#/ + +/## + module tnsl.time + Functionality for conversion, parsing, printing, and measuring of time + +#; export module time +;/ \ No newline at end of file diff --git a/spec/1.md b/spec/1.md index 47e6834..493bace 100644 --- a/spec/1.md +++ b/spec/1.md @@ -4,9 +4,9 @@ ### Folder Structure -Normal TNSL project structure has a root source folder with TNSL files contained within the folder and sub-folders. It is normal for the root folder to represent a single library or binary, although there is no strict rule enforcing this. Standard organization is to place sub-modules in sub-folders. The file name for the module entry point should match the folder name. +Normal TNSL project structure has a root source folder with TNSL files contained within the folder and sub-folders. It is normal for the root folder to represent a single library or binary, although there is no strict rule enforcing this. Standard organization is to place sub-modules in sub-folders. The file name for the module's entry point should match the folder name. -The file representing the compile target is known as the root file, which generally resides in the root source folder. This file will contain a main method, and/or the pre-processor statement `rootfile` to denote the root of a library. If both are present, the compiler will generate an executable by default unless the `--otype` flag is set to `library` or `tlet`. +The file representing the compile target is known as the root file, which generally resides in the root source folder. This file will contain a main method, and/or the pre-processor statement `rootfile` to denote the root of a library. If both are present, the compiler will generate an executable by default. ### TNSL Files diff --git a/tnslc/ast/ast.tnsl b/tnslc/ast/ast.tnsl new file mode 100644 index 0000000..405a94a --- /dev/null +++ b/tnslc/ast/ast.tnsl @@ -0,0 +1,19 @@ +/## + 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 +#/ + +/; export module ast + :import "node.tnsl" +;/ \ No newline at end of file diff --git a/tnslc/ast/node.tnsl b/tnslc/ast/node.tnsl new file mode 100644 index 0000000..5eeac91 --- /dev/null +++ b/tnslc/ast/node.tnsl @@ -0,0 +1,85 @@ +/## + 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 +#/ + +# AST node (non-block) +;struct Node { + tnslc.parse.Token + # associated token to the node + data, + + ~{}Node + # sub-nodes + sub +} + +# AST node (block) +;struct BlockNode extends Node { + super, + + ~{}Node + # block inputs and outputs + blockIn, + blockOut, + + ~{}tnslc.parse.Token + # block qualifiers + blockQs +} + +# Node methods +/; method Node + + /; operator delete + ;delete this.data, this.sub + ;/ + + /; push_sub (Node node) [uint] + ;uint len = this.sub.length + ;alloc this.sub, len + 1 + ;this.sub{len} = node + ;return len + 1 + ;/ +;/ + +# Extended block node methods +/; method BlockNode + + /; operator delete + ;super() + ;delete this.blockQs, this.blockIn, this.blockOut + ;/ + + /; push_blockQ (tnslc.parse.Token token) [uint] + ;uint len = this.blockQs.length + ;alloc this.blockQs, len + 1 + ;this.blockQs{len} = token + ;return len + 1 + ;/ + + /; push_blockIn (Node node) [uint] + ;uint len = this.blockIn.length + ;alloc this.blockIn, len + 1 + ;this.blockIn{len} = node + ;return len + 1 + ;/ + + /; push_blockOut (Node node) [uint] + ;uint len = this.blockOut.length + ;alloc this.blockOut, len + 1 + ;this.blockOut{len} = node + ;return len + 1 + ;/ +;/ \ No newline at end of file diff --git a/tnslc/compile/arch/arch.tnsl b/tnslc/compile/arch/arch.tnsl new file mode 100644 index 0000000..5e81673 --- /dev/null +++ b/tnslc/compile/arch/arch.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 arch + :import "compile/arch/common.tnsl" + :import "compile/arch/isa_x86.tnsl" +;/ \ No newline at end of file diff --git a/tnslc/compile/arch/common.tnsl b/tnslc/compile/arch/common.tnsl new file mode 100644 index 0000000..cba0d9f --- /dev/null +++ b/tnslc/compile/arch/common.tnsl @@ -0,0 +1,17 @@ +/## + 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 +#/ + +; struct instruction {} \ No newline at end of file diff --git a/tnslc/compile/arch/isa_arm.tnsl b/tnslc/compile/arch/isa_arm.tnsl new file mode 100644 index 0000000..0dc3468 --- /dev/null +++ b/tnslc/compile/arch/isa_arm.tnsl @@ -0,0 +1,15 @@ +/## + 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 +#/ diff --git a/tnslc/compile/arch/isa_risc_v.tnsl b/tnslc/compile/arch/isa_risc_v.tnsl new file mode 100644 index 0000000..0dc3468 --- /dev/null +++ b/tnslc/compile/arch/isa_risc_v.tnsl @@ -0,0 +1,15 @@ +/## + 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 +#/ diff --git a/tnslc/compile/arch/isa_x86.tnsl b/tnslc/compile/arch/isa_x86.tnsl new file mode 100644 index 0000000..0dc3468 --- /dev/null +++ b/tnslc/compile/arch/isa_x86.tnsl @@ -0,0 +1,15 @@ +/## + 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 +#/ diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl new file mode 100644 index 0000000..263dc59 --- /dev/null +++ b/tnslc/compile/compile.tnsl @@ -0,0 +1,21 @@ +/## + 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 compile + :include "compile/arch/arch.tnsl" + :include "compile/format/format.tnsl" + +;/ diff --git a/tnslc/compile/format/elf.tnsl b/tnslc/compile/format/elf.tnsl new file mode 100644 index 0000000..8490180 --- /dev/null +++ b/tnslc/compile/format/elf.tnsl @@ -0,0 +1,151 @@ +/## + 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 +#/ + +# Constants and values used in ELF files + +# File signature +;const {4}uint8 SIGNATURE_ELF = {0x7F, 'E', 'L', 'F'} + +# ELF version always 1 +;const uint8 VERSION_ELF = 1 + +# OS identifiers (from wikipedia) +;enum ABI_ELF [uint8] { + SystemV = 0x0, + HP_UX = 0x1, + NetBSD = 0x2, + Linux = 0x3, + GNUHurd = 0x4, + Solaris = 0x6, + AIX = 0x7, + IRIX = 0x8, + FreeBSD = 0x9, + Tru64 = 0xA, + OpenBSD = 0xC, + OpenVMS = 0xD +} + +# ELF file types (from wikipedia) +;enum TYPE_ELF [uint16] { + ET_NONE = 0x0, + ET_REL = 0x1, + ET_EXEC = 0x2, + ET_DYN = 0x3, + ET_CORE = 0x4, + ET_LOOS = 0xFE00, + ET_HIOS = 0xFEFF, + ET_LOPROC = 0xFF00, + ET_HIPROC = 0xFFFF +} + +# ISA (from wikipedia) +;enum ARCH_ELF [uint16] { + NONE = 0x0, + SPARC = 0x2, + x86_32 = 0x3, + MIPS = 0x8, + PowerPC = 0x14, + PowerPC64 = 0x15, + ARM = 0x28, + SPARC9 = 0x2B, + IA_64 = 0x32, + x86_64 = 0x3E, + ARM64 = 0xB7, + RISC_V = 0xF3 +} + +# Some zeros to fill out the pad in the header +;const {7}uint8 PAD_ZEROS_ELF = {0, 0, 0, 0, 0, 0, 0} + + + +# Internal file structures + +# Identity inside header +;raw struct IdentityELF { + {4}uint8 + signature, + + uint8 + class, + data, + version, + abi, + + # Usually zero + abiVersion, + + {7}uint8 + # Filled with zeros, use PAD_ZEROS_ELF to fill out + pad +} + +# Main header (32 bit) +;raw struct HeaderELF32 { + IdentityELF + identity, + + uint16 + fileType, + arch, + + {4}uint8 + version, + entry, + programHeader, + sectionHeader, + + {4}uint8 + flags, + + uint16 + headerSize, + programHeaderSize, + programHeaderEntries, + sectionHeaderSize, + sectionHeaderEntries, + shNameIndex +} + +# Main header (64 bit) +;raw struct HeaderELF64 { + IdentityELF + identity, + + uint16 + fileType, + arch, + + {4}uint8 + version, + + {8}uint8 + entry, + programHeader, + sectionHeader, + + {4}uint8 + flags, + + uint16 + headerSize, + programHeaderSize, + programHeaderEntries, + sectionHeaderSize, + sectionHeaderEntries, + shNameIndex +} + diff --git a/tnslc/compile/format/format.tnsl b/tnslc/compile/format/format.tnsl new file mode 100644 index 0000000..2d4ed4b --- /dev/null +++ b/tnslc/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/compile/format/iex.tnsl b/tnslc/compile/format/iex.tnsl new file mode 100644 index 0000000..e69de29 diff --git a/tnslc/compile/format/out.tnsl b/tnslc/compile/format/out.tnsl new file mode 100644 index 0000000..e69de29 diff --git a/tnslc/compile/format/pe.tnsl b/tnslc/compile/format/pe.tnsl new file mode 100644 index 0000000..e69de29 diff --git a/tnslc/flags/flags.tnsl b/tnslc/flags/flags.tnsl new file mode 100644 index 0000000..bc5d43f --- /dev/null +++ b/tnslc/flags/flags.tnsl @@ -0,0 +1,16 @@ +/## + 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 +#/ + diff --git a/tnslc/parse/parse.tnsl b/tnslc/parse/parse.tnsl new file mode 100644 index 0000000..ec65f7b --- /dev/null +++ b/tnslc/parse/parse.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 parse + :include "tnslc/parse/token.tnsl" + :include "tnslc/parse/tokenizer.tnsl" +;/ \ No newline at end of file diff --git a/tnslc/parse/token.tnsl b/tnslc/parse/token.tnsl new file mode 100644 index 0000000..0134483 --- /dev/null +++ b/tnslc/parse/token.tnsl @@ -0,0 +1,295 @@ +/# + 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 +#/ + +/# The various types of tokens #/ +; enum TOKEN_TYPE [int] { + LINESEP = 0, + INLNSEP = 1, + DELIMIT = 2, + AUGMENT = 3, + LITERAL = 4, + KEYTYPE = 5, + PREWORD = 6, + KEYWORD = 7, + DEFWORD = 8 +} + +/# Token struct definition #/ +; struct Token { + int + token_type, + line, + col, + + ~{}charp + data +} + +/; method Token + + /; operator delete + ;delete self.data + ;/ + + /; add_char (~{}charp part) + # ;uint l = len self.data` + # ;realloc self.data, l + len part + /;loop (int i = 0; i < len part`) [i++] + # ;self.data`{l + i} = part{i} + ;self.data`.append(part`{i}) + ;/ + ;/ +;/ + +/# + Reserved words and characters, as well as + helper funcs for checking their token types. +#/ + +;{}{}charp PREWORDS = { + "include", + "define", + "extern", + "size", + "align", + "address", + "rootfile", + "if", + "else", + "abi" +} + +;const {}{}charp KEYTYPES = { + "bool", + "char", + "charp", + + "int8", + "int16", + "int32", + "int64", + "int", + "uint8", + "uint16", + "uint32", + "uint64", + "uint", + + "float32", + "float64", + "float", + + "void", + "type" +} + +;{}{}charp KEYWORDS = { + "struct", + "interface", + "enum", + "is", + "extends", + + "loop", + "continue", + "break", + + "match", + "case", + "default", + + "label", + "goto", + + "if", + "else", + + "const", + "static", + "volatile", + + "method", + "override", + "self", + "super", + "operator", + + "raw", + "asm", + "inline", + + "delete", + + "module", + "export" +} + +;{}{}charp LITERALS = { + "true", + "false" +} + +;{}charp RESERVED = "`~!#%^&*()-=+[]{}|;:,.<>/" + +;{}charp DELIMITS = "()[]{}" +;{}charp LINESEPS = ";:#" +;{}charp INLNSEPS = "," +;{}charp AUGMENTS = "~`.&|^>>", + + # PREaugmented augmentors + "&=", + "|=", + "^=", + "+=", + "-=", + "*=", + "/=", + "%=", + "~=", + "`=", + + # POSTaugmented augmentors + "!&", + "!|", + "!^", + "!==", + "!&&", + "!||", + "!>", + "!<", + ">==", + "<==", + + # Increment and De-increment + "++", + "--" +} + +;int MAX_MRESERVED = 3 + +/## + Checks if the character point p is in the string cmp + +#; is_in_string (~{}charp cmp, charp p) [bool] + + /; loop (int i = 0; i < len cmp`) [i++] + /; if (s == cmp`{i}) + ;return true + ;/ + ;/ + + ;return false +;/ + +/## + Checks if the string s is in the list cmp + +#; is_in_string_list (~{}{}charp cmp, ~{}charp s) [bool] + + /; loop (int i = 0; i < len cmp`) [i++] + + /; if (len s == len cmp`{i}) + + /; loop (int j = 0; j < len s`) [j++] + + /; if (s`{j} !== cmp`{i}{j}) + ;break 1 + ;/ + ;/ + + ;return true + ;/ + + ;/ + + ;return false +;/ + +/# + Get the token_type value for a given string of character points + +#; get_token_type (~{}charp s) [int] + + /; if (len s > 1) + + /; if (is_in_string_list(~PREWORDS, s)) + ;return TOKEN_TYPE.PREWORD + ;; else if (is_in_string_list(~KEYTYPES, s)) + ;return TOKEN_TYPE.KEYTYPE + ;; else if (is_in_string_list(~KEYWORDS, s)) + ;return TOKEN_TYPE.KEYWORD + ;; else if (is_in_string_list(~LITERALS, s)) + ;return TOKEN_TYPE.LITERAL + ;; else if (is_in_string_list(~MDELIMITS, s)) + ;return TOKEN_TYPE.DELIMIT + ;; else if (is_in_string_list(~MAUGMENTS, s)) + ;return TOKEN_TYPE.AUGMENT + ;/ + + ;return TOKEN_TYPE.DEFWORD + + ;;else if (len s` == 1) + + /; if (is_in_string(~DELIMITS, s`{0})) + ;return TOKEN_TYPE.DELIMIT + ;; else if (is_in_string(~LINESEPS, s`{0})) + ;return TOKEN_TYPE.LINESEP + ;; else if (is_in_string(~INLNSEPS, s`{0})) + ;return TOKEN_TYPE.INLNSEP + ;; else if (is_in_string(~AUGMENTS, s`{0})) + ;return TOKEN_TYPE.AUGMENT + ;/ + + ;return TOKEN_TYPE.DEFWORD + ;/ + + # What, we just produce vacant tokens now? + # Something has gone wrong. + + ;return -1 +;/ \ No newline at end of file diff --git a/tnslc/parse/tokenizer.tnsl b/tnslc/parse/tokenizer.tnsl new file mode 100644 index 0000000..54671fe --- /dev/null +++ b/tnslc/parse/tokenizer.tnsl @@ -0,0 +1,53 @@ +/# + 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 +#/ + +/; is_space (charp c) [bool] + ;return c == '\t' || c == '\n' || c == ' ' +;/ + +/; break_token ({}charp dat, charp c) [bool] + /; if (len dat == 0) + ;return false + + ;/ + ;return is_space(c) +;/ + +/; parse_reserved ({}charp dat) [{}Token] + +;/ + +/; tokenize (tnsl.io.File fstr) [~{}Token] + ;{}Token out = {} + ;{}charp tdat = {} + + /; loop (int i = fstr.read(); i !== -1) [i = fstr.read()] + /; if (break_token(tdat, i)) + /; if (len tdat > 0) + ;{}charp tmp = tdat + ;Token ttk = {0, 0, 0, ~tmp} + ;out.append(ttk) + ;tdat = {} + ;/ + ;; else if ( !is_space(i) ) + ;tdat.append(i) + ;/ + ;/ + + ;tnsl.io.println(tdat) + + ;return ~out +;/ diff --git a/tnslc/src/ast/ast.tnsl b/tnslc/src/ast/ast.tnsl deleted file mode 100644 index 405a94a..0000000 --- a/tnslc/src/ast/ast.tnsl +++ /dev/null @@ -1,19 +0,0 @@ -/## - 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 -#/ - -/; export module ast - :import "node.tnsl" -;/ \ No newline at end of file diff --git a/tnslc/src/ast/node.tnsl b/tnslc/src/ast/node.tnsl deleted file mode 100644 index 5eeac91..0000000 --- a/tnslc/src/ast/node.tnsl +++ /dev/null @@ -1,85 +0,0 @@ -/## - 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 -#/ - -# AST node (non-block) -;struct Node { - tnslc.parse.Token - # associated token to the node - data, - - ~{}Node - # sub-nodes - sub -} - -# AST node (block) -;struct BlockNode extends Node { - super, - - ~{}Node - # block inputs and outputs - blockIn, - blockOut, - - ~{}tnslc.parse.Token - # block qualifiers - blockQs -} - -# Node methods -/; method Node - - /; operator delete - ;delete this.data, this.sub - ;/ - - /; push_sub (Node node) [uint] - ;uint len = this.sub.length - ;alloc this.sub, len + 1 - ;this.sub{len} = node - ;return len + 1 - ;/ -;/ - -# Extended block node methods -/; method BlockNode - - /; operator delete - ;super() - ;delete this.blockQs, this.blockIn, this.blockOut - ;/ - - /; push_blockQ (tnslc.parse.Token token) [uint] - ;uint len = this.blockQs.length - ;alloc this.blockQs, len + 1 - ;this.blockQs{len} = token - ;return len + 1 - ;/ - - /; push_blockIn (Node node) [uint] - ;uint len = this.blockIn.length - ;alloc this.blockIn, len + 1 - ;this.blockIn{len} = node - ;return len + 1 - ;/ - - /; push_blockOut (Node node) [uint] - ;uint len = this.blockOut.length - ;alloc this.blockOut, len + 1 - ;this.blockOut{len} = node - ;return len + 1 - ;/ -;/ \ No newline at end of file diff --git a/tnslc/src/compile/arch/arch.tnsl b/tnslc/src/compile/arch/arch.tnsl deleted file mode 100644 index 5e81673..0000000 --- a/tnslc/src/compile/arch/arch.tnsl +++ /dev/null @@ -1,20 +0,0 @@ -/## - 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 arch - :import "compile/arch/common.tnsl" - :import "compile/arch/isa_x86.tnsl" -;/ \ No newline at end of file diff --git a/tnslc/src/compile/arch/common.tnsl b/tnslc/src/compile/arch/common.tnsl deleted file mode 100644 index cba0d9f..0000000 --- a/tnslc/src/compile/arch/common.tnsl +++ /dev/null @@ -1,17 +0,0 @@ -/## - 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 -#/ - -; struct instruction {} \ No newline at end of file diff --git a/tnslc/src/compile/arch/isa_arm.tnsl b/tnslc/src/compile/arch/isa_arm.tnsl deleted file mode 100644 index 0dc3468..0000000 --- a/tnslc/src/compile/arch/isa_arm.tnsl +++ /dev/null @@ -1,15 +0,0 @@ -/## - 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 -#/ diff --git a/tnslc/src/compile/arch/isa_risc_v.tnsl b/tnslc/src/compile/arch/isa_risc_v.tnsl deleted file mode 100644 index 0dc3468..0000000 --- a/tnslc/src/compile/arch/isa_risc_v.tnsl +++ /dev/null @@ -1,15 +0,0 @@ -/## - 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 -#/ diff --git a/tnslc/src/compile/arch/isa_x86.tnsl b/tnslc/src/compile/arch/isa_x86.tnsl deleted file mode 100644 index 0dc3468..0000000 --- a/tnslc/src/compile/arch/isa_x86.tnsl +++ /dev/null @@ -1,15 +0,0 @@ -/## - 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 -#/ diff --git a/tnslc/src/compile/compile.tnsl b/tnslc/src/compile/compile.tnsl deleted file mode 100644 index 263dc59..0000000 --- a/tnslc/src/compile/compile.tnsl +++ /dev/null @@ -1,21 +0,0 @@ -/## - 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 compile - :include "compile/arch/arch.tnsl" - :include "compile/format/format.tnsl" - -;/ diff --git a/tnslc/src/compile/format/elf.tnsl b/tnslc/src/compile/format/elf.tnsl deleted file mode 100644 index 8490180..0000000 --- a/tnslc/src/compile/format/elf.tnsl +++ /dev/null @@ -1,151 +0,0 @@ -/## - 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 -#/ - -# Constants and values used in ELF files - -# File signature -;const {4}uint8 SIGNATURE_ELF = {0x7F, 'E', 'L', 'F'} - -# ELF version always 1 -;const uint8 VERSION_ELF = 1 - -# OS identifiers (from wikipedia) -;enum ABI_ELF [uint8] { - SystemV = 0x0, - HP_UX = 0x1, - NetBSD = 0x2, - Linux = 0x3, - GNUHurd = 0x4, - Solaris = 0x6, - AIX = 0x7, - IRIX = 0x8, - FreeBSD = 0x9, - Tru64 = 0xA, - OpenBSD = 0xC, - OpenVMS = 0xD -} - -# ELF file types (from wikipedia) -;enum TYPE_ELF [uint16] { - ET_NONE = 0x0, - ET_REL = 0x1, - ET_EXEC = 0x2, - ET_DYN = 0x3, - ET_CORE = 0x4, - ET_LOOS = 0xFE00, - ET_HIOS = 0xFEFF, - ET_LOPROC = 0xFF00, - ET_HIPROC = 0xFFFF -} - -# ISA (from wikipedia) -;enum ARCH_ELF [uint16] { - NONE = 0x0, - SPARC = 0x2, - x86_32 = 0x3, - MIPS = 0x8, - PowerPC = 0x14, - PowerPC64 = 0x15, - ARM = 0x28, - SPARC9 = 0x2B, - IA_64 = 0x32, - x86_64 = 0x3E, - ARM64 = 0xB7, - RISC_V = 0xF3 -} - -# Some zeros to fill out the pad in the header -;const {7}uint8 PAD_ZEROS_ELF = {0, 0, 0, 0, 0, 0, 0} - - - -# Internal file structures - -# Identity inside header -;raw struct IdentityELF { - {4}uint8 - signature, - - uint8 - class, - data, - version, - abi, - - # Usually zero - abiVersion, - - {7}uint8 - # Filled with zeros, use PAD_ZEROS_ELF to fill out - pad -} - -# Main header (32 bit) -;raw struct HeaderELF32 { - IdentityELF - identity, - - uint16 - fileType, - arch, - - {4}uint8 - version, - entry, - programHeader, - sectionHeader, - - {4}uint8 - flags, - - uint16 - headerSize, - programHeaderSize, - programHeaderEntries, - sectionHeaderSize, - sectionHeaderEntries, - shNameIndex -} - -# Main header (64 bit) -;raw struct HeaderELF64 { - IdentityELF - identity, - - uint16 - fileType, - arch, - - {4}uint8 - version, - - {8}uint8 - entry, - programHeader, - sectionHeader, - - {4}uint8 - flags, - - uint16 - headerSize, - programHeaderSize, - programHeaderEntries, - sectionHeaderSize, - sectionHeaderEntries, - shNameIndex -} - diff --git a/tnslc/src/compile/format/format.tnsl b/tnslc/src/compile/format/format.tnsl deleted file mode 100644 index 2d4ed4b..0000000 --- a/tnslc/src/compile/format/format.tnsl +++ /dev/null @@ -1,20 +0,0 @@ -/## - 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/compile/format/iex.tnsl b/tnslc/src/compile/format/iex.tnsl deleted file mode 100644 index e69de29..0000000 diff --git a/tnslc/src/compile/format/out.tnsl b/tnslc/src/compile/format/out.tnsl deleted file mode 100644 index e69de29..0000000 diff --git a/tnslc/src/compile/format/pe.tnsl b/tnslc/src/compile/format/pe.tnsl deleted file mode 100644 index e69de29..0000000 diff --git a/tnslc/src/flags/flags.tnsl b/tnslc/src/flags/flags.tnsl deleted file mode 100644 index bc5d43f..0000000 --- a/tnslc/src/flags/flags.tnsl +++ /dev/null @@ -1,16 +0,0 @@ -/## - 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 -#/ - diff --git a/tnslc/src/parse/parse.tnsl b/tnslc/src/parse/parse.tnsl deleted file mode 100644 index e10ab4c..0000000 --- a/tnslc/src/parse/parse.tnsl +++ /dev/null @@ -1,22 +0,0 @@ -/## - 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 -#/ - -/; export module parse - /:import - "token.tnsl" - "tokenizer.tnsl" - :/ -;/ \ No newline at end of file diff --git a/tnslc/src/parse/token.tnsl b/tnslc/src/parse/token.tnsl deleted file mode 100644 index 21abe7b..0000000 --- a/tnslc/src/parse/token.tnsl +++ /dev/null @@ -1,295 +0,0 @@ -/# - 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 -#/ - -/# The various types of tokens #/ -; enum TOKEN_TYPE [uint] { - LINESEP = 0, - INLNSEP = 1, - DELIMIT = 2, - AUGMENT = 3, - LITERAL = 4, - KEYTYPE = 5, - PREWORD = 6, - KEYWORD = 7, - DEFWORD = 8 -} - -/# Token struct definition #/ -;raw struct Token { - uint - token_type, - line, - col, - - ~{}charp - data -} - -/; method Token - - /; operator delete - ;delete self.data - ;/ - - /; 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} - ;/ - ;/ -;/ - -/# - Reserved words and characters, as well as - helper funcs for checking their token types. -#/ - -;const {}{}charp PREWORDS = { - "include", - "define", - "extern", - "size", - "align", - "address", - "rootfile", - "if", - "else", - "abi" -} - -;const {}{}charp KEYTYPES = { - "bool", - "char", - "charp", - - "int8", - "int16", - "int32", - "int64", - "int", - "uint8", - "uint16", - "uint32", - "uint64", - "uint", - - "float32", - "float64", - "float", - - "void", - "type" -} - -;const {}{}charp KEYWORDS = { - "struct", - "interface", - "enum", - "is", - "extends", - - "loop", - "continue", - "break", - - "match", - "case", - "default", - - "label", - "goto", - - "if", - "else", - - "const", - "static", - "volatile", - - "method", - "override", - "self", - "super", - "operator", - - "raw", - "asm", - "inline", - - "delete", - - "module", - "export", -} - -;const {}{}charp LITERALS = { - "true", - "false" -} - -;const {}charp DELIMITS = "()[]{}" -;const {}charp LINESEPS = ";:#" -;const {}charp INLNSEPS = "," -;const {}charp AUGMENTS = "~`.&|^>>", - - # PREaugmented augmentors - "&=", - "|=", - "^=", - "+=", - "-=", - "*=", - "/=", - "%=", - "~=", - "`=", - - # POSTaugmented augmentors - "!&", - "!|", - "!^", - "!==", - "!&&", - "!||", - "!>", - "!<", - ">==", - "<==", - - # Increment and De-increment - "++", - "--" -} - -; const uint MAX_MRESERVED = 3 - -/## - Checks if the character point p is in the string cmp - -#; is_in_string (const {}charp` cmp, charp p) [bool] - - /; loop (int i = 0; i < len cmp) [i++] - - /; if (s == cmp{i}) - ;return true - ;/ - ;/ - - ;return false -;/ - - -/## - Checks if the string s is in the list cmp - -#; is_in_string_list (const {}{}charp` cmp, {}charp` s) [bool] - - /; loop (int i = 0; i < len cmp) [i++] - - /; if (len s == len cmp{i}) - - /; loop (int j = 0; j < len s) [j++] - - /; if (s{j} !== cmp{i}{j}) - ;goto cont_outer - ;/ - ;/ - - ;return true - ;/ - - ;label cont_outer - ;/ - - ;return false -;/ - -/# - Get the token_type value for a given string of character points - -#; get_token_type ({}charp` s) [int] - - /; if (len s > 1) - - /; if (is_in_string_list(~PREWORDS, ~s)) - ;return TOKEN_TYPE.PREWORD - ;; else if (is_in_string_list(~KEYTYPES, ~s)) - ;return TOKEN_TYPE.KEYTYPE - ;; else if (is_in_string_list(~KEYWORDS, ~s)) - ;return TOKEN_TYPE.KEYWORD - ;; else if (is_in_string_list(~LITERALS, ~s)) - ;return TOKEN_TYPE.LITERAL - ;; else if (is_in_string_list(~MDELIMITS, ~s)) - ;return TOKEN_TYPE.DELIMIT - ;; else if (is_in_string_list(~MAUGMENTS, ~s)) - ;return TOKEN_TYPE.AUGMENT - ;/ - - ;return TOKEN_TYPE.DEFWORD - - ;;else if (len s == 1) - - /; if (is_in_string(~DELIMITS, s{0})) - ;return TOKEN_TYPE.DELIMIT - ;; else if (is_in_string(~LINESEPS, s{0})) - ;return TOKEN_TYPE.LINESEP - ;; else if (is_in_string(~INLNSEPS, s{0})) - ;return TOKEN_TYPE.INLNSEP - ;; else if (is_in_string(~AUGMENTS, s{0})) - ;return TOKEN_TYPE.AUGMENT - ;/ - - ;return TOKEN_TYPE.DEFWORD - ;/ - - # What, we just produce vacant tokens now? - # Something has gone wrong. - - ;return -1 -;/ \ No newline at end of file diff --git a/tnslc/src/parse/tokenizer.tnsl b/tnslc/src/parse/tokenizer.tnsl deleted file mode 100644 index 4e5eeb7..0000000 --- a/tnslc/src/parse/tokenizer.tnsl +++ /dev/null @@ -1,38 +0,0 @@ -/# - 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 -#/ - -:using 'tnsl' - -/## - parse.numeric_literal tokenizes the next numeric literal value in a file. - Returns a token with the proper data as well as the number of characters read - -#; numeric_literal (io.text_stream fstream) [Token, uint] - ;Token out = {token_type: TOKEN_TYPE.LITERAL} - ;uint counter = 0 - - ;bool l, d, run = false, false, true - ;~{}charp num - - ;num, run = fstream.read_number() - - /; loop (run) [num, run = fstream.read_number()] - ;out.add_data(num) - ;delete num - ;/ - - ;return out, counter -;/ \ No newline at end of file diff --git a/tnslc/src/tnslc.tnsl b/tnslc/src/tnslc.tnsl deleted file mode 100644 index 212819e..0000000 --- a/tnslc/src/tnslc.tnsl +++ /dev/null @@ -1,38 +0,0 @@ -/## - 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 tnslc - :import "flags/flags.tnsl" - :import "parse/parse.tnsl" - :import "ast/ast.tnsl" - :import "compile/compile.tnsl" -;/ - - -/; main (~{}{}char args) [int] - ;tnslc.flags.Flags argList = tnslc.flags.parse(args) - - ;{}tnslc.parse.Token tokenList = tnslc.parse.tokenize(argList) - - ;tnslc.ast.Node ast = ast.generate(tokenList) - - ;tnsl.io.File outFile = tnsl.io.open_file(argList.outPath) - ;[]uint8 data = tnslc.compile.generate(argList, ast) - - ;outFile.write(data) - - ;outFile.close() -;/ diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl new file mode 100644 index 0000000..99be327 --- /dev/null +++ b/tnslc/tnslc.tnsl @@ -0,0 +1,41 @@ +/## + 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 tnslc + :include "tnslc/parse/parse.tnsl" +;/ + + +/; test + +;/ + +/; main ({}{}charp args) [int] + /; if (len args < 1) + ;tnsl.io.println("Usage: tnslc [File to compile] ") + ;return 1 + ;/ + + ;tnsl.io.File src = tnsl.io.readFile(args{0}) + + ;~{}tnslc.parse.Token psrc = tnslc.parse.tokenize(src) + + ;tnsl.io.println(psrc`) + + ;src.close() + + ;return 0 +;/ -- cgit v1.2.3