Commit Graph

37 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 62ca320c76 Compiler
- Removed unses `Lexer[]` `lexers` array
- Disabled some tests
2023-01-20 21:20:54 +02:00
Tristan B. Velloza Kildaire 44f8392450 - Ren-enabled tests for multiple files 2023-01-20 15:13:21 +02:00
Tristan B. Velloza Kildaire a987f114ac Compiler
- Moved configuration sub-system to its own class `CompilerConfiguration`
- `getConfig()` and `setConfig()` are now templatised to generate, at compile-time, type-specific versions which will fetch and convert using the requested type
- Added some more default configuration parameters for DGen

DGen

- Implemented configuration checking for `genTabs()` and `emitEntryPoint()` (both which have the default config value of `true`)
- Added commented-out testing code (see issue #88)
2023-01-19 21:06:20 +02:00
Tristan B. Velloza Kildaire a772b55966 Compiler
- Added missing `typeChecker.beginCheck()` call to the TypChecker in `compile()`
- Print error on lexing error
- Removed old compilation code and replaced with an instantiation of a `Compiler` object and a corresponding call to `.compile()`
2023-01-19 18:10:39 +02:00
Tristan B. Velloza Kildaire a7bfed12fb Compiler
- Added parameter configuration management interface for the `Compiler` object
- Added `defaultConfig()` for setting the default config
2023-01-17 19:43:37 +02:00
Tristan B. Velloza Kildaire 37debd8160 Compiler
- Added some comments and now use the provided `outFile` for code emitting stage in `Compiler` class
2023-01-16 12:07:11 +02:00
Tristan B. Velloza Kildaire 167e946b34 Compiler
- Implemented type `Compiler` which wraps compilation all into one object which can have `compile()` called on it to perform the full sequence of tests
2023-01-16 11:56:54 +02:00
Tristan B. Velloza Kildaire 8a481fb0ac App
- Added newline to release info print
- Fixed module docstring

Commands

- Added new command-line options: `syntaxcheck`, `typecheck`
- Added todo to `help` command
- Re-ordered commands for order of appearance in help text

Compiler

- Added docstring to `beginCompilation(string[])` function

Mapper

- Added debug print of the Container being used for the symbol lookup

CodeEmitter

- Re-worked CodeEmitter class to use a single so-called "selected queue"
- Added methods to move back and forth between said "selected queue", get the length, etc.
- Remove old queue-specific methods

DGen

- Use the new CodeEmitter "selected-queue" functionality
- Emit function definitions now supported

Exceptions

- Added this keyword

Check

- Added support for SymbolTYpe.OCURLY and SymbolType.CCURLY to `getCharacter(SymbolType)`

Data

- Added a `hasParams()` method to the Function entity type

TypeChecker

- Added support for emitting function definitions (required DNode.poes = [] (cleaning), codeQueue cleaning etc.)
- Added `getInitQueue()` method to make a copy of the current "scratchpad" `codeQueue`
- Build up a copy of the global queue now (make a copy similiar to what we did for `getInitQueue()` but inline)
- Added a debug print

Dependency

- Added a FIXME note for issue #46
- Added a TODO relating to `static DNode[] poes`

Test cases

- Added test case `simple_function_decls.t` to test function definition code emit
- Updated test case `simple_variables.t` to note that the T code generates invalid C code

README

- Build instructions now generate coverage files (`.lst`s)
- Updated link to documentation
2022-12-14 19:49:08 +02:00
Tristan B. Velloza Kildaire 6a64ed40c9 CodeEmitter
- Added `finalize()` method, this is to be called whenever the emitting is done and a compiler is to be called on the code

DGen

- Implemented a gcc-based finalization method
- Added `emitEntryPoint()` to emit a main() function which is to be called in libc's `_start` symbol

VariableDeclaration

- Added note we may need a symbol table lookup system actually, rather than just a simple `symbolRename`

Compiler

- Call the `finalize()` method on the DGen code emitter

----

Test cases

- Added `simple_variables_only_decs.t` to test code generation
2022-12-11 21:41:15 +02:00
Tristan B. Velloza Kildaire b43e8de0ef Compiler
- Make output file `tlangout.c`
2022-12-11 17:43:24 +02:00
Tristan B. Kildaire ff9890437d Working code emitter and doing some code gen with it too 2021-11-02 15:13:44 +02:00
Tristan B. Velloza Kildaire 3dba481260 Refactored code emitter sub-system 2021-11-02 10:41:03 +02:00
Tristan B. Kildaire 653495b324 Disabled code generation (for now) 2021-06-09 19:49:49 +02:00
Tristan B. Kildaire 55ccf00e29 Disabl typechecking unit tests for now
Need to simplify code base a lot
2021-06-08 10:52:22 +02:00
Tristan B. Kildaire 8028fc1d7b WIP: Make the compiler more like a library 2021-06-08 10:30:15 +02:00
Tristan B. Kildaire 4b13c88c51 DGen works, D code can be generated 2021-06-01 15:24:13 +02:00
Tristan B. Kildaire d8f82e17de Added plumbing for testing D (not final, we shall use LLVM) code generation 2021-06-01 15:18:21 +02:00
Tristan B. Velloza Kildaire a770f5f5c9 WIP: Get containers to return when you have no parent 2021-04-01 15:39:06 +02:00
Tristan B. Velloza Kildaire ede134e9d8 No need for specificity here, only in unit tests 2021-04-01 14:52:52 +02:00
Tristan B. Velloza Kildaire 49b9ac29d1 Added some code for future use to print stack trace 2021-04-01 14:52:15 +02:00
Tristan B. Velloza Kildaire 5a541bdb21 Format errors nicely 2021-04-01 14:46:02 +02:00
Tristan B. Velloza Kildaire 8a32272660 WIP 2021-04-01 14:38:11 +02:00
Tristan B. Velloza Kildaire 5f6c9b5f57 Cleaned up variable declaring
Also declared variables when assignment is completed
2021-03-30 18:02:13 +02:00
Tristan B. Velloza Kildaire 0445534cda Refactored symbols 2021-03-30 17:35:16 +02:00
Tristan B. Velloza Kildaire 6649804d4e Refactoring
Removed uneeded type 'Symbol'
2021-03-30 17:31:37 +02:00
Tristan B. Kildaire 9c829302a5 WIP 2021-03-29 21:06:37 +02:00
Tristan B. Velloza Kildaire 9c72756336 Added support for lexing `a.a`
Moved `isAlpha` to utils.d

Return false on lexing failures, true otherwise

Abort compilation and lexing failures
2021-03-28 19:48:07 +02:00
Tristan B. Kildaire 5c8e30f1f5 Run type checker system
WIP: Resolution of names

Reworked type hierachy for Enity in relation to Function, Variable and Class

Updated test case
2021-03-23 21:35:13 +02:00
Tristan B. Velloza Kildaire 87f7f458c8 Call type checker 2021-03-21 21:43:05 +02:00
Tristan B. Velloza Kildaire f2b1956555 Added needed plumbing for parser 2021-03-03 13:30:56 +02:00
Tristan B. Velloza Kildaire 85efca8b87 Compiler now reads source file 2021-03-03 13:14:28 +02:00
Tristan B. Velloza Kildaire a7c0d37a01 Removed testing code 2021-03-02 23:22:46 +02:00
Tristan B. Velloza Kildaire acab7dd5f3 Support for several splitter characters added 2021-03-02 22:43:09 +02:00
Tristan B. Velloza Kildaire cce91b6615 Added support for semi-colon delimiting 2021-03-02 22:31:18 +02:00
Tristan B. Velloza Kildaire 1f103bf190 Basic lexer added
Supports splitting by whitespace
Supports escaping into string mode and returning back to whitespace splitting mode
2021-03-02 22:26:35 +02:00
Tristan B. Velloza Kildaire 7a2b73a299 Call compilation entry point 2021-03-02 21:55:45 +02:00
Tristan B. Velloza Kildaire 505764b8bb Added directory structure 2021-03-02 21:14:23 +02:00