Official Tristan Language project compiler https://deavmi.assigned.network/projects/tlang
Go to file
Tristan B. Velloza Kildaire b352b7d3f6 MetaProcessor
- When getting the type root everything on the `Program` rather than `tc.getModule()`. We therefore now use the `tc.getProgram()` in its place. This updates the `sizeOf_Literalize(string typeName)` method.

DGen

- `emit()` has been updated to enumerate all `Module[]` of the given `Program` and then calls the respecitve `emit(...)` methods with a (`File`, `Module`) which contains the file which emitting should be written to and also the `Module` being emitted.
- At the end of `emit()` we then try to find the `Module` which contains a function named `main` and then set that as the entrypoint. If such a `main` function cannot be found we then go and do a check whether or not the `dgen:emit_entrypoint_test` configuration option is `true`, if so we then try emit a testing entrypoint and assume that the tst uses only one `Module` (this is something to be cleaned up later; as in all tests should have a `main` method).
- Implemented `findEntrypoint(ref Module mainModule, ref Function mainFunc)` which does as the name implies and finds the containing `Module` which has a `Function` named `"main"` and if so sets both ref arguments and returns `true`, otherwise they are left unset and `false` is returned
- `emitHeaderComment(...)`, `emitStaticAllocations(...)`, `emitFunctionPrototypes(...)`, `emitFunctionDefinitions(...)`, `emitFunctionPrototype(...)`, `emitFunctionDefinition(...)`, `emitCodeQueue(...)`, `emitStdint(...)`, `emitEntrypoint(...)`, `emitTestingEntrypoint(...)` now takes in `File modOut` and `Module mod`
- Note the above have not YET been updated to select correct code queues, static init. queues and `emitEntrypoint(...)` has not yet been implemented
- Updated `emitTestingEntrypoint(...)` to check using the incoming `Module`'s name
- `finalize()` will now compile all sources files, then it will link all generated object files together; optionally cleaning up all but the final genersted excutable at the end

CollidingNameException

- Fixed up name generation (we now anchor on the `Program`)
- Fixed up how we detect if a module's name is in use. We now will check and ensure it doesn't match ANY of the modules contained within the `Program`

DNode

- Implemented `forceName(string)` to set the `name` field forcefully
- The `generate()` method now calls `generalPass(Module, Context)` on each of the `Program`'s `Module`s. We then get an array of `DNode[]` from them. After this we then create a root `DNode` to represent the program and then we make it `needs(DNode)` each `Module` `DNode` created previously.

DNodeGenerator

- When processing `VariableExpression` in `expressionPass(Expression exp, Context context)`, if we get a `Function` being referred to in the expression, then we now set the `Context`'s `Container` still to the `Module` containing the function's definition, _however_ we use a method from the resolver to ensure it is the correct module (because we are now using a multi-module setup).
- We have always set the **root** `Module` when entering `generalPass(Container c, Context context)` and processing a `Function` but, as with the last change mentioned above, we need to find that containing `Module` correctly. Therefore we use a method from the `Resolver` to do that.
2024-02-27 09:01:06 +02:00
.github/workflows Pipelines 2023-12-08 18:27:42 +02:00
branding Array support (#1) 2023-04-20 11:21:50 +02:00
rando Fuck this is complicated (2/2) 2021-06-06 22:46:06 +02:00
scratch Makefile 2024-02-25 19:24:38 +02:00
source/tlang MetaProcessor 2024-02-27 09:01:06 +02:00
.gitignore 🐞️ Functions: Expressionless return and enforcing requirement (#7) 2023-07-11 21:43:21 +02:00
README.md Update README.md 2023-08-21 14:41:22 +02:00
dub.json Dub 2023-11-03 14:10:40 +02:00
extern_test.sh Testing 2023-12-05 13:01:33 +02:00
macro_ast_replacemenet.png 🧠 Feature: Meta-programming engine (#10) 2023-05-29 17:02:28 +02:00
macro_ast_replacemenet.xcf 🧠 Feature: Meta-programming engine (#10) 2023-05-29 17:02:28 +02:00
macro_ast_replacement_sizeof_example.png 🧠 Feature: Meta-programming engine (#10) 2023-05-29 17:02:28 +02:00
macro_ast_replacement_sizeof_example.xcf 🧠 Feature: Meta-programming engine (#10) 2023-05-29 17:02:28 +02:00
malloc_test.sh Pointer support (#2) 2023-04-17 16:50:11 +02:00
tets.d Added testing files 2021-11-02 15:14:03 +02:00
texterned.c - Added `texterned.c` for later extern testing 2023-01-19 17:52:46 +02:00
tlang 🧠️ Feature: Universal coercion and type enforcer (#9) 2023-08-10 19:42:11 +02:00
todo1.md I wonder if that worked 2021-06-07 14:27:36 +02:00
wip.txt Array support (#1) 2023-04-20 11:21:50 +02:00

README.md

tlang

D Coverage Status

Official Tristan Language project compiler

Documentation

Docs are available here.

Building

To build you will need dmd and dub installed. You can then run the following:

dub test --coverage
dub build

The first command is optional but you want to make sure the compiler is working so you may as well run all the unit tests - it won't take too long.

Usage

A list of all commands can be found by typing in the following:

./tlang