| Age | Commit message (Collapse) | Author |
|
|
|
|
|
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
|
|
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.
|
|
Add PIPs prpoposal and state management proposal
|
|
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
|
|
|
|
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
|
|
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.
|
|
|
|
This is incomplete because the scalar variables are not addressable
right now. To be addressable they must be represented as reflect
values, not interfaces.
|
|
|
|
|
|
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.
|
|
Recursive structs and embedded structs are not supported yet.
|