Adds:
- UnaryOperator: AST node for unary operators -, ++, --, and so forth
- UnaryOperatorOptimizer: optimizes a unary operator with its operand
- now integer and float negation, and integer inversion
- later x[y]++ to a single instruction
Also:
- automatically include basic.em, which includes some parameter defaults like -1.
This allows the compiler to generate output for a hello, world script with the exact same .ecl output as the legacy compiler.
Adds support for var statements at the global level.
Adds:
- analyzer/Variables: keeps track of the variables in scope (either local or global).
- ast/Identifier: AST node for an identifier.
- The optimizer will replace constant identifiers with their constant value (in a later commit).
- The semantic analyzer will set the variable field for local or global variable identifiers.
- ast/VarStatement: AST node for a var statement.
- A single var statement will generate one VarStatement per variable declared.
- model/Variable: Describes a variable, including its index within its scope.
Adds:
- ast/Argument: AST node for an argument passed to a function.
- ast/FunctionCall: AST node for a function call.
- codegen/ModuleDeclarationRegistrar: The code generator registers module function declarations with this in order to determine module indexes and function indexes for instructions.
- model/FunctionLink: this is a reference either:
- from: a FunctionCall or a FunctionReference
- to: a ModuleFunctionDeclaration or a UserFunction
- optimizer/ReferencedFunctionGatherer: a visitor that determines which module functions and user functions are referenced, by looking at function calls and function references.
Also:
- CodeGenerator registers module functions
- InstructionGenerator generates code for function calls
- InstructionEmitter generates TOK_FUNC instructions
- StoredTokenDecoder decodes TOK_FUNC instructions
After all of this, the compiler can compile print("hello, world");
Adds enough to build the AST nodes for the module function declarations in a .em file.
Adds:
- Function: base class for module function declarations and user functions
- FunctionParameterDeclaration: declaration for a function parameter, as well as its default value if any
- FunctionParameterList: just a holder for function parameter declarations
- ModuleFunctionDeclaration: for function declarations in .em files
- FunctionResolver: hooks up function calls to module functions or user functions
- ModuleProcessor: a visitor for processing const declarations and module function declarations (const declarations are yet to come from the main branch)
* Update grammar
- add '=' to grammar so that we can report appropriate errors
- add elvis ?: operator
- add foreachIterableExpression to match old compiler (which only allows certain expressions)
- allow both byref and unused on the same function parameter
- rename methodCall -> functionCall
- rename memberCall -> methodCall
- add named parser rule for functionReference
- move everything that isn't expression(s) with operators into primary
- expression is now just the left-recursive rules and prefix operators
- add named parser rules for struct, dictionary, error, array initialization
- remove special-case for named parameters with := from function call argument, because it is ambiguous with assignment
- Moved array access, object member access, and object method calls to navigationSuffix
* Regen grammar
* Upgrade Vagrant setup to Ubuntu 20.04 (focal64)
* Add clang and clang-format.
Now build_tools.sh -c works too
* Update comment: refer to git repo, not SVN
* by default on windows the clib pch shouldnt be reused and instead rebuild
* activate reuse_pch for windows ci build
* changed pch header from public to private
* Added explicit path to the lib/ folder.
* Added use_zlib() function to the cmake files. Changed the remaining cmake files to use POL_EXT_LIB_DIR.
* Removed relative path to zlib. It seems we were always using our zlib header (even when linking to the system zlib on linux!).
* force antlr to always build in release node also for multiconfigs
set the correct c++ runtime flag for clang on windows
fixed lib path for antlr
in CI also test msbuild and different modes then release
* cache antlr in nopch and force recompile in pch build
* force release mode also for curl
* Return the full spec for item.hitscript and item.onhitscript. The relative name wasn't very helpful.
* Added breaking changes.txt. We can add more breaking changes later.
* Added ScriptDef::qualifiedname(). Returns the full spec necessary to call the script ("::scriptname" or ":pkgname:scriptname"). Returns an empty string if there is no script.
* python script to generate cpp file with BareDistro content
poltool cmd to generate the files
* updated baredistro, fixed compilation
* fix warning, ignore autogenerated file in stylechecker
* test for pol?
uoconvert got a new argument outdir for the cfg file output
single thread decay has now a upper limit of sleeptime
fixed that the exit_code can only get worse
basic files for core testing in testsuite
added a not really nice way to set it up via ctest
integrated in CI with upload of log output
* testenv
* update poltool filegeneration to c++17
* first real tests
* first npc test
* equip a backpack and test a bit aos props
* fixed early returns
* Add codegen/InstructionEmitter
* Add codegen/InstructionGenerator
* CodeGenerator: emit progend
Checkpoint: compiler can compile an empty file
* Comment reason for having both emit and emitter.
The Disambiguator will correct the AST based on context.
At present, it needs to handle ambiguities in the grammar between
case group selectors and named break/continue labels.
Build antlr as external project inside of lib/antlr.
Cache in Ci the antlr folder to speed up compilation times.
* replace ERROR with ANTLR_ERROR, fix clang build
* added missing define needed to link on windows
* different lib name with clang on windows
* move to c++17
* update readme with new compiler requirements
* use c++17 filesystem in testfiles creation
* use gcc9
* Vagrant support for c++17: use gcc9 and llvm 7 (#199)
Co-authored-by: Eric Swanson <eric.the.unicorn@gmail.com>
Add astbuilder/BuilderWorkspace:
- Temporary workspace used while building the AST (which goes in the CompilerWorkspace)
Add astbuilder/CompilerWorkspaceBuilder:
- Builds a CompilerWorkspace for a script
Add model/CompilerWorkspace:
- Holds AST
- Holds some intermediate data used by semantic analyzer, optimizer, code generator
* Add compiler/Profile
* Add compiler/Report
* From CR notes: add newline on caught exception.
Also added comments that messages should have a newline at the end.