- Lookup the value of `dgen:compiler` from the config and use that as the C compiler
Configuration
- Set default value of `dgen:compiler` to `"clang"`
Commands
- Added a command to specify the C compile to use
- Transfer `-cccompiler`/`-cc` over to a config entry
- Now lookup `dgen:mapper` instead of `emit:mapper`
Configuration
- Now set `dgen:mapper` to `hashmapper` instead of `emit:mapper`
- Added `dgen_preinline_args` and set it to `false`
Commands
- Updated description for `symbol-mapper`/`sm` flag
- The `symbol-mapper`/`sm` flag now affects the `dgen:mapper` entry instead of the `emit:mapper` entry
- Transfer the flag value of `preinlineArguments`/`pia` to the `dgen:preinline_args` entry
* ⚡️ Feature: Lexer Interface cleanup (#14)
* LexerInterface
Defined the lexer interface
* Parser
- Fixed import for `Token` class
- Removed the token management fields such as `tokens`, `currentToken` and `tokenPtr` as these are now replaced by our `LexerInterface`, `lexer` field which manages this all for us
- Removed constructor which accepts a `Token[]`, now onyl accept a `LexerInterface`
- Removed `nextToken()`, `hasTokens()`, `getCurrentToken()`, `previousToken()`, `setCursor(ulong)` and `getCursor()`.
- The above now are called via the `lexer` instance
Parser (unit tests)
- Migrated to new `LexerInterface`+`BasicLexer` system
- Hoisted out common imports for unit tests into a `version(unittest)`
TypeChecker (unittests)
- Hoisted out common imports for unit tests into a `version(unittest)`
- Migrated to new `LexerInterface`+`BasicLexer` system
LexerInterface
- Moved to new `lexer.core` package
- Documented module and class
Commands
- Fixed imports for the (now) `BasicLexer`
- Fixed imports for the (now) `lexer.core` package
Compiler
- Fixed imports for the (now) `BasicLexer`
- Use `LexerInterface` instead of `Lexer`
- The `doLex()` method now uses an instance of `BasicLexer` and then downcasts to quickly call `performLex()` in order to tokenize and make them available
- The `doParse()` method now takes in an instance of `LexerInterface` rather than `Token[]`
BasicLexer (previously Lexer)
- Moved to the `lexer.kinds` package
- Now implements `LexerInterface`
- Documented module and class
- Documented the `LexerInterface` methods
Exceptions
- Moved to the `lexer.core` package
- Fixed import of `Token` class
- Now uses `LexerInterface`
Core.Lexer.Package
- Documented package module
Tokens
- Moved to the `lexer.core` package
- Documented module and class
Check
- Fixed import for `Token`
- Fixed import for `BasicLexer`
* `core.lexer` (package)
- Documented all public imports
* Exceptions
- Documented the module
- Documented `LexerError` and its members
- Documented `LexerException`, its members too
* Tokens
- Documented the fields (using proper syntax)
- Documented constructor and methods
* BasicLexer
- Removed now-completed TODO
- Added (for clarity) `override` keywords to the `getLine()` and `getColumn()` methods
- Moved `getLine()`, `getColumn()` and `getTokens()` altoghether
- Made `getTokens()` override-marked
- Documented `getTokens()`
* Check
- Removed weird TODO that makes no sense
- Documented some of the members of `SymbolType`
* Check
- Documented a few more enum members of `SymbolType`
- Fixed documentation (and added a TODO) for the `SymbolType.LE_SYMBOL`
* Check
- Documented a few more enum members of `SymbolType`
* Check
- Documented `isType(string)`
- Added a TODO for `isTYpe(string)` to "Check if below is even used
- Documented `isPathIdentifier(string)`
* Check
- Updated description of `isPathIdentifier(string)` to note it can contain underscores
- Documented isIdentifier(string)`
- Updated `SymbolType.IDENT_TYPE` to acknowledge underscores
- Documented `isAccessor(Token token)` and `isModifier(Token)`
* Check
- Documented `isIdentifier_NoDot(Token tokenIn)`, `isIdentifier_Dot(Token tokenIn)`, `isNumericLiteral(string token)`
- Removed uneeded import of `BasicLexer`
- Moved import to the top of file
* Check
- Documented `getSymbolType(Token tokenIn)`, `isMathOp(Token token)`, `isBinaryOp(Token token)`
* Check
- Documented the `symbols.check` module
* Builtins
- Properly documented `getBuiltInType(TypeChecker, string)`
* Builtins
- Documented module
* Typing (core)
- Documented module
- Documented all members
* Exceptions (lexer)
- Fixed documentation missing parameters
* Check
- Make comments docs/ddox compatible
* BasicLexer
- Fixed parameter name in documentation
* BasixLexer
- Fixed formatting in documentation for class
* Typing (core)
- Documented all remaining class members and fields
- Fixed module naming; autocomplete now works
Typing
- Added a TODO/NOTE comment
Parser
- Implemented range-based literal type encoding for integer literals
Check
- Switched from directly calling `isNumeric(string)` to our own `isNumericLiteral(string)` to check if a token is a `SymbolType.NUMBER_LITERAL`
Test cases
- Added new test case `simple_literals3.t`
- Enable pretty code generation on the command-line by default
- Explicitly make the `SymbolMappingTechnique.HASHMAPPER` the default symbol translation technique
- Corrected import path for `compiler.lexer` -> `compiler.lexer.core`
Parser
- Corrected import path for `compiler.lexer` -> `compiler.lexer.core`
TypeChecker
- Corrected import path for `compiler.lexer` -> `compiler.lexer.core`
Compiler
- Moved configuration code outside of it
- Renamed to `compiler.core`
DGen
- Check for any object files to link in, if so append them to the `cc` call
Lexer
- Moved from `compiler.lexer` to `compiler.lexer.core`
Configuration
- Overhauled configuration system
Mapper
- Added definition to `SymbolMappingTechnique`
Command-line
- Migrated to new configuration system
- Migrated `SymbolMappingTechnique` to Mapper module
- Added support for specifying object fils to link in using the `-ll` flag`
Tests
- Added `file_io.c` for testing `simple_extern.t` with `extern_test.sh`
- Added `extern_test.sh` for testing `simple_extern.t`
- Upgraded to jcli 0.25.1-beta
- Added aggregate command-line arguments `library-link` to support future library linking
- Added stub mixin template `TypeCheckerBase`
- Made verbosity an optional flag
- Compiler flag name change
- Comment formatting
Compiler
- Implemented `getConfig()` in order to return the `Compiler` object's `CompilerConfiguration` instance
- Updated a configuration parameters name in the `defaultConfig()`
- Added some work-in-progress data structures `ConfigObject` and `ConfigList`
Command-line
- Added a plethorah of new flags and re-worked a lot of the common flags across the multiple commands to use mixins to avoid code duplication and enforce code re-use
- The compilation command now uses the `Compiler` object
- You can now control the symbol mapper used
- You can now set the verbosity level (no-oped currently)
- You can set the output filename
- You can set whether pretty code is to be used or not
- You can set whether or not to generate the entrypoint testing code during emit
- All compilation stages now make use of the `Compiler` object
Compiler
- Added new exception type `CompilerException` complete with a sub-type enum, `CompilerError`
- `getConfig()` will now throw a `CompilerException` when a key is not found, rather than return false (which didn't work under different template types anyways)
- Implemented `hasConfig()` to check for the existence of a key in the configuration sub-system's key-value store
- The `Compiler` object now stores the `Token[] tokens` generated from the call to `doLex()`
- The `Compiler` object now stores the resulting container (`Module`) generated from the call to `doParse()`
- Set default symbol mapping technique to the hashmapper technique
- Implemented `dolex()` for performing tokenization, it will create and store a `Lexer` instance and the produced `Token[] tokens` into the `Compiler` object
- Added `getTokens()` to fetch the tokens generated by `doLex()`
- Implemented `doParse()`, `doTypeCheck()` and `doEmit()` in a similiar fashion to `doLex()`
- Implemented `getMdoule()` to get the container (`Module`) generated by `doParse()`
- Implemented `compile()` which calls `doLex()`, then `doParse()`, then `doTypeCheck()` and finally `doEmit()`
CodeEmitter
- The `CodeEmitter` constructor now takes in an instance of the chosen `SymbolMapper`
DGen
- Switched to the instance of the `mapper` inheited from the `CodeMapper` parent class for any `symbolMap` calls required
- Use the inherited `TypeChecker` instance and not an instance of it provided by `Context`
SymbolMapper
- Reworked this class into an abstract class which must have its children implement a `symbolMap(Entity)` interface, this provides us pluggable mapping techniques
HashMapper
- Moved hashing symbol-mapping technique into `HashMapper`
Lebanese
- Created a kind-of `SymbolMapper` which, unlike `HashMapper`, produces human-redable-yet-valid C symbols (by replacing the `.`'s with `_`'s)
TypeChecker
- Removed code for setting now-nonexistent `SymbolMapper.tc`
- Removed code for setting now-nonexistent `Context.tc`
Context
- Removed `static TypeChecker tc` field
- Fully integrated new `LexerException` system into `performLex()`
COmmand-line
- Updated `commands.d` to catch any `TError` and report the error back
Parser
- Updated unittests to use `LexerException`
Compiler
- Disabled unit tests for now as they cause errors
- 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