Commit Graph

364 Commits

Author SHA1 Message Date
Ludovic Fernandez
83c21d4bc0 doc: move dev things. (#29) 2019-01-22 18:12:08 +01:00
Ludovic Fernandez
3f000e5fac refactor: clean and plugin tests (#26)
* refactor: remove gi_c
* refactor: new intergation example.
* chore: adds new targets.
* doc: adds issue template.
2019-01-22 15:53:52 +01:00
Ludovic Fernandez
3c674c2cc4 fix: remove hardcoded port. (#27)
* fix: remove hardcoded port.

* fix: genop.
2019-01-22 15:31:28 +01:00
Marc Vertes
08f4aabdc0 feat: generate operator functions (#25)
Add `cmd/genop` program to generate operator functions in `interp/op.go`.

For each operator, determine its type, handle argument types conversion if necessary.

Arithmetic operators are added for now. Assign and comparison operators coming in a next commit.
2019-01-22 14:10:28 +01:00
Marc Vertes
2ef097e334 feat: better error handling in type parsing (#24)
When parsing types, instead of panic, set proper error and diagnostic with source location.
Propagate errors correctly.
2019-01-21 22:03:40 +01:00
Marc Vertes
015bff1599 feat: handle recover builtin (#13)
The recovered state is stored in `Frame`, and captured in `runCfg()`.
`assign()` has been modified to set handle `interface{}` type (not
possible with `reflect`.
2019-01-17 21:15:10 +01:00
Marc Vertes
1aff64765a feat(cfg): improve handling of errors and diagnostics in cfg (#12)
The AST walk is now interrupted as soon as the CFG global `err` is set.
`cfgError()` print the position in source, in addition to the user
diagnostic. `cfgError()` is now invoked when a symbol is undefined.
2019-01-17 21:14:43 +01:00
Marc Vertes
f4490ff851 Fix: multi-assign expression panic (#15)
* Fix: multi-assign expression panic

The following corrections are done:
* interp/ast.go: in case of ast.ValueSpec node, fix the decision between
multi-assign or single assign
* interp/cfg.go: in multi-assign parse, skip type symbol if it is
present
2019-01-17 20:59:45 +01:00
Marc Vertes
098829d316 style: fix warnings from golangci-lint printed by make check (#11)
* style: fix warnings from golangci-lint printed by `make check`
* style: err assign in if block when possible. Better use of switch/case
* style: err assign in if block when possible
2019-01-16 18:59:24 +01:00
Marc Vertes
7987a97847 feat(ast): handle defer statement (#8) 2019-01-15 12:33:02 +01:00
Marc Vertes
547b1afb8d feat(goexports): support multi os / arch, generate syscalls for all platforms (#6) 2019-01-11 17:41:26 +01:00
Marc Vertes
bd15f88be6 feat: add support for select statement (#5)
* ast: improve error handling
* ast: handle select
* dyngo: set filename of executed script
* cfg: improve error reporting
* Implement select for receiving channels
* feat(select): add support for sending channels in case clauses
* test: improve tests on select
* feat(select): add support for "default" case
2019-01-09 17:45:38 +01:00
Fernandez Ludovic
45893a87a8 refactor: goexports use go template. 2019-01-07 23:46:36 +01:00
Fernandez Ludovic
3bf45a4b32 refactor: generate syscall for linux. 2019-01-07 11:36:05 +01:00
Fernandez Ludovic
3c00ca4469 fix: quick review. 2019-01-07 11:35:12 +01:00
Fernandez Ludovic
1e4efe0a72 chore: add linting. 2019-01-07 11:34:04 +01:00
Marc Vertes
86b2ffedcd stdlib: add syscall package 2018-12-26 15:46:42 -05:00
Marc Vertes
1bb4060ab2 goexports: set package name from working directory 2018-12-21 15:00:15 +01:00
Marc Vertes
4a065cb4de Update dyngo to use interpreter REPL 2018-12-20 18:22:24 +01:00
Marc Vertes
9bce65c284 REPL: fix prompt if output is not stdout 2018-12-20 16:39:33 +01:00
Marc Vertes
3c542659cc Make REPL part of interp package 2018-12-20 16:17:46 +01:00
Marc Vertes
97a03d8be1 repl: parse multiple line expressions 2018-12-20 15:23:34 +01:00
Marc Vertes
13e104156b ast() returns an error instead of panicking 2018-12-19 19:47:17 +01:00
Marc Vertes
29f5a29d28 rename interp2.go into inception.go 2018-12-19 16:39:23 +01:00
Marc Vertes
27cbeef38d Methods created in the interpreter can now be used by runtime 2018-12-19 15:10:26 +01:00
Marc Vertes
42e891da02 Fix DO NOT EDIT comment on generated files 2018-12-19 11:41:48 +01:00
Marc Vertes
ed5fa33ea2 Add -i flag to start an REPL after eval file 2018-12-18 19:14:55 +01:00
Marc Vertes
f8a4aba39b Add interpreter inception example 2018-12-11 17:23:24 -08:00
Marc Vertes
ba3f015c16 Fix golint warnings 2018-12-11 10:34:21 -08:00
Marc Vertes
b0ef0a00db Interpreter now exports itself, so scripts can do Eval() too 2018-12-11 10:29:43 -08:00
Marc Vertes
480ef53daf Get rid of Export(). Fix golint warnings 2018-12-11 03:38:51 -08:00
Marc Vertes
6a23877ce2 Eval: wrap returned interpreter node into a callable function 2018-12-11 03:12:50 -08:00
Marc Vertes
6a397e2294 Fix golint warnings 2018-12-07 17:37:58 +01:00
Marc Vertes
ea07c12f56 Support incremental parse and eval, and interactive mode 2018-12-07 17:16:11 +01:00
Marc Vertes
befbe23695 Load binary dependencies with Import() 2018-12-06 16:16:54 +01:00
Marc Vertes
6b013ffd35 Simplify export to runtime 2018-12-04 15:14:02 +01:00
Marc Vertes
e508591277 Compute frame types for binary wrapper around closures 2018-12-03 12:05:42 +01:00
Marc Vertes
4eab01911e Fix range for slices of binary objects 2018-12-02 17:46:27 +01:00
Marc Vertes
487e24e829 Type assertion: add support for 2nd return value 2018-12-01 17:56:55 +01:00
Marc Vertes
c75807dec9 Fix type assertions for runtime objects. Work in progress.
Function typeAssert() now returns the concrete value of interface{}
object defined in the runtime.

What is missing is actual type checking against provided type, and
support for the variant returning 2 values, the concrete value and
boolean status.
2018-12-01 14:49:56 +01:00
Marc Vertes
8bc2f14b78 Fix make to handle both runtime and interpreter defined types 2018-11-30 15:13:05 +01:00
Marc Vertes
5143f37a86 Handle dereference of boolean pointer. Uniformize boolean builtins 2018-11-30 12:08:01 +01:00
Marc Vertes
5c7b669fcc Fix handling chan boolean values 2018-11-29 19:28:12 +01:00
Marc Vertes
eb56b7dbb1 Fix handling array boolean values 2018-11-29 19:15:53 +01:00
Marc Vertes
18258dcd75 Fix handling map boolean values 2018-11-29 18:58:42 +01:00
Marc Vertes
1552194f11 Fix handling of boolean struct fields 2018-11-29 18:28:44 +01:00
Marc Vertes
658b32cf1e Handle branching in binary function calls 2018-11-29 16:59:14 +01:00
Marc Vertes
a0b659fa8a Handle branching in boolean functions 2018-11-29 16:36:21 +01:00
Marc Vertes
65933b2441 Test equality on interface, for compatibility with all comparable types.
This is slower than direct test on value, which requires code geneation
(next step).
2018-11-29 13:40:26 +01:00
Marc Vertes
e7d185fc0e Fix frame allocation in unary expression 2018-11-29 11:25:09 +01:00