| Age | Commit message (Collapse) | Author |
|
|
|
Mutating scanner tokens or reusing scanner token attributes to
store other metadata is a hack. Introduce a new parser token
type with arbitrary args. The next step will be to use the arg
field instead of scanner token fields.
|
|
- vm: added Pull, Next and Stop instructions, to implement iterators
- lang: add Range, Next and Stop tokens
- parser: handle range clause. Still naive and incomplete.
- comp: generate iterator instructions from range clause.
Work in progress. Only initial support for slices. Many more tests
and combinations needed, but the main pattern is there now.
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
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.
|
|
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
|
|
|
|
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.
|
|
|
|
Logical operators `&&` (and), `||` (or) are now parsed in expressions.
The control flow tokens (labels, conditional jumps) are added
accordingly.
|