| Age | Commit message (Collapse) | Author |
|
|
|
Added 2 VM instructions, FnewE variant of Fnew with a dereference,
and FieldE, variant of Field with dereference.
It's now possible to pointers in structs and literal composites.
|
|
|
|
A new token MapAssign is added to implement assignements involving
a map, slice or array, an index key expression and a value expression.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The expressions were parsed from right to left, and it was incorrect and
cumbersome. Now they are processed from left to right, with a simpler
and correct handling of precedence rules.
The vm function call syntax has been changed to set the function
before the input arguments on the stack, as to follow the declaring
order in languages.
|
|
|
|
|
|
|
|
Added missing vm instructions to allocate a typed value on the stack
and to set a structure field.
It's possible now to generate struct literal composites for non
keyed struct fields.
|
|
|
|
Also improve the setup of golangci-lint.
|
|
Pass a language spec as an argument when create a new parser,
compiler or interpreter.
Also move the REPL code in interpreter package.
|
|
|
|
|
|
|
|
|
|
|
|
Use custom types for VM instructions. More idiomatic code for tracing.
|
|
|
|
|
|
|
|
Use 'unsafe' to modify private struct fields, allowing to keep
unmodified field names: before they were prefixed with a capital.
Parse package statement. Provide a also a default package name for
REPL and tests. The support of packages is still incomplete.
|
|
* 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.
|
|
The `import` statement is now parsed. It only provides minimal
support for the `fmt` package (only `Println` symbol is defined).
This should be sufficient to pass a few tests.
Full support of package namespaces, source and binary imports will be
supported later, based on this work.
|
|
feat: Add simple Dump creation and recovery.
|
|
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
|
|
Memory Dump functionality that can restore the previous VM state.
It dumps *global* variables, the only ones defining the program state.
The dump depends on the program itself, and on the index system, which right now is defined by the variable order.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
|
|
|
|
|
|
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>
|
|
fix: force a return at end of function
|
|
|
|
This will avoid infinite loops, and is necessary for functions with
no returned values. This doesn't remove the need to better check the
consistency of return statements in general.
|
|
|
|
feat: add type representation in vm package
|