| Age | Commit message (Collapse) | Author |
|
* fix (parser): don't panic if assign of define untyped value
In case of defining or assigning to untyped value, the type has
to be taken from the source value instead of the target value.
The vm test coverage has also been slightly improved.
* fix and simplify Token.Name()
* improve parser errors
|
|
A new `Composite` token is created. Literal composite expressions
are recognized and partially handled by the parser but not yet
by the code generator.
Other cosmetic changes are present.
|
|
* chore: add linters and some lint fixes
Configure some golangci-lint linters to get the code quality right.
Apply the first fixes.
Next step will be to add github actions to run lint and tests in
github CI.
* chore: more lint, fixed comments and variable names. no semantic change.
* chore: add Makefile
This makefile is intended to be used as a local substitute to github
actions.
|
|
|
|
Also detection and automatic execution of main function.
Make sure that all debug is output to stderr.
|
|
Fix: small README fixes and throw an error if expression not supported.
|
|
Co-authored-by: Marc Vertes <mvertes@free.fr>
|
|
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
|
|
Type and Value types in vm package are now used in place of reflect.Type
and reflect.Value. It allows to remove the dependency on reflect for
parser and compiler packages.
The main purpose of Type is to provide a solution to implement recursive
structs, named types, interfaces and methods, despite the limitations of
Go reflect. The goal is to provide the thinnest layer around reflect.
|
|
A 'New' instruction is added in VM to manage initialisation
of typed variables in the stack. The instantiated type symbols
are now added to global data. Accessing and setting values by
address is now working.
|
|
|
|
|
|
|
|
The structures are reresented by reflect values. New instructions
`Field` and `Vassign` have been added to the VM to assign reflect
values and access struct fields.
|
|
Only symbols are produced, no bytecode is emitted. The constant
expressions are evaluated at compile time using the stdlib package
go/constant. The parser handles implicit repetition of the last
non-empty expression list. The iota symbol is reset to 0 and
incremented for each line of a const block.
To be done in a next commit: type conversions.
|
|
|
|
A VM instruction `EqualSet` has been added to preserve the left
operand on the stack in case of failure, to allow efficient
multiple tests on the same value.
Both the pattern 'if/else if' and the classical case clauses have
been implemented.
|
|
Logical operators `&&` (and), `||` (or) are now parsed in expressions.
The control flow tokens (labels, conditional jumps) are added
accordingly.
|
|
|
|
* chore: refactor to keep only the new parser and bytecode vm
* scanner: remove Token.value field
* scanner: remove scanner.kind field
* chore: move language specification in lang package
This avoid a cyclic dependency in scanner_test which can now use
the golang/GoSpec language specification for Go.
* clean code
* scanner: export scanner fields
Also parser now generate function calls, including externals.
* chore: fix lint issues
* parser: handle strings
* wip
* parser: implement support for 'if, else, else if' statements
Resolving labels in the compiler still in progress.
* parser: support if statements, improve compiler
* improve handling of functions
* improve support of local variables
* scanner: trim leading and trailing spaces
* fixes to make fibonacci work
* parser: improve README, fix function parameters parsing
|