mirror of https://github.com/tbklang/tlang.git
Official Tristan Language project compiler
https://deavmi.assigned.network/projects/tlang
Tristan B. Velloza Kildaire
b352b7d3f6
- 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. |
||
---|---|---|
.github/workflows | ||
branding | ||
rando | ||
scratch | ||
source/tlang | ||
.gitignore | ||
README.md | ||
dub.json | ||
extern_test.sh | ||
macro_ast_replacemenet.png | ||
macro_ast_replacemenet.xcf | ||
macro_ast_replacement_sizeof_example.png | ||
macro_ast_replacement_sizeof_example.xcf | ||
malloc_test.sh | ||
tets.d | ||
texterned.c | ||
tlang | ||
todo1.md | ||
wip.txt |
README.md
tlang
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