| Age | Commit message (Collapse) | Author |
|
Pass a language spec as an argument when create a new parser,
compiler or interpreter.
Also move the REPL code in interpreter package.
|
|
|
|
|
|
|
|
* 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
|
|
* 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.
|
|
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>
|
|
|
|
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
|
|
Also isolate repl in a separate function.
Introduce `run` function for executing programs, letting room for
other verbs to be done later: test, debug, ...
Use file path as argument. Standard input redirect is no more mandatory.
|
|
Also simplify project structure. The executable is now produced in
the root directory. Work in progress.
|