Commit Graph

58 Commits

Author SHA1 Message Date
Marc Vertes
567985f0cf Improve handling of out of order declarations 2018-07-24 16:32:08 +02:00
Marc Vertes
915d976d12 Improve creation of local vars. Change handling package state and metadata (in progress) 2018-07-20 10:19:31 +02:00
Marc Vertes
8ab3c06e5a Fix handling of closures 2018-07-05 18:57:53 +02:00
Marc Vertes
6277727660 Add support for negate expressions 2018-07-03 16:14:41 +02:00
Marc Vertes
4bb9d61c3f Fix type access from source packages 2018-07-03 14:45:53 +02:00
Marc Vertes
77c015fcb8 Handle type assertions (first attempt) 2018-06-27 14:59:23 +02:00
Marc Vertes
b608e2f3c2 Add support for iota 2018-06-22 02:52:45 +02:00
Marc Vertes
deb1c0136c Add support to variadic functions 2018-06-21 12:39:50 +02:00
Marc Vertes
71c4ec10b2 Improve type handling, simplify arrays 2018-06-19 16:40:24 +02:00
Marc Vertes
9d1fe83dcd Add support for slice expressions 2018-06-14 00:00:31 +02:00
Marc Vertes
b4c6624f3c Do not export private AST node fields 2018-06-13 15:42:01 +02:00
Marc Vertes
912a37be7b Add support to import source packages 2018-06-07 12:03:18 +02:00
Marc Vertes
e7b21fb31f preliminary work to support interfaces and type assertion 2018-06-06 10:32:16 +02:00
Marc Vertes
9064f91264 Improve types, pointers and methods. Add several tests. 2018-05-25 19:32:06 +02:00
Marc Vertes
62da45a792 Appease vet and lint gods 2018-05-18 16:43:44 +02:00
Marc Vertes
00ad9cc2ce improve interpreter init. Allow re-entrant Eval() 2018-05-17 13:33:17 +02:00
Marc Vertes
583acadf8b Allow runtime to call intrepreted functions
A function in the interpreter can now be wrapped into a reflect
generated func, to be callable by runtime (pre-compiled code).
As an example, see test/server.go, a complete http server with
scripts callbacks.
2018-05-11 19:47:21 +02:00
Marc Vertes
a9af4de31d AST: transform multi assignement into several single assigns 2018-05-08 17:52:43 +02:00
Marc Vertes
f50a028d55 ast: transform multi assign statement into single ones 2018-05-04 10:51:23 +02:00
Marc Vertes
3e159d482d add support for pointers 2018-04-30 13:52:28 +02:00
Marc Vertes
4646a60665 improve type assignation 2018-04-23 22:19:49 +02:00
Marc Vertes
47138b9351 add % (remain) operator 2018-04-17 11:06:07 +02:00
Marc Vertes
b909d2a9b6 add != (notEqual) binary operator 2018-04-17 10:59:19 +02:00
Marc Vertes
9cf1bc3df8 add missing for variant 2018-04-17 10:52:24 +02:00
Marc Vertes
94fbbb0a4d Fix stringers, use log, improve bin imports (in progress) 2018-04-11 18:21:59 +02:00
Marc Vertes
efff619135 import: handle return values of exported functions 2018-04-09 16:26:22 +02:00
Marc Vertes
fc6ddccf52 Add support for binary imports (in progress) 2018-04-06 20:19:14 +02:00
Marc Vertes
ccbe8e943b Fix frame handling in closures
The logic to decide if frame must be forked at execution is now
performed at compile time (simple/faster execution).
New test to handle in-place closure calling.
2018-04-05 09:15:01 +02:00
Marc Vertes
f38b7101ae Add support for closures 2018-04-04 14:15:58 +02:00
Marc Vertes
b353217571 Improve scope handling. Allow anonymous functions. Work in progress.
Frames are now managed in a tree fashion rather than a list.
Each time a new level of namespace is created, a new branch of frames
is forked. For example, between the global namespace and the local one,
or between a local namespace and a nested function. Access to variables
in upper namespaces is performed through indirections in the frames
ancestorship. Note that a new frame is created a each function call,
but not necessarily a new branch. When a new frame is created, it
inherits its ancestor from the caller frame, so only one indirection
is necessary to access a global var, even in a deep recursive call.

For each named variable, the compiler stores the frame index and the
frame level, i.e. the number of indirections in the frame tree.
2018-03-27 22:22:52 +02:00
Marc Vertes
acfa049e46 Fix function forward declaration, fix related test. 2018-03-19 11:47:33 +01:00
Marc Vertes
8306293eb1 Improve init and handling of maps 2018-03-16 15:50:54 +01:00
Marc Vertes
64c1c24e13 Add support for channels 2018-03-13 16:49:11 +01:00
Marc Vertes
ede896f438 add make() builtin to create arrays, map and channels. In progress 2018-03-13 08:42:08 +01:00
Marc Vertes
0cfd439858 handle builtin calls in CFG rather than execution 2018-03-12 14:17:58 +01:00
Marc Vertes
7d489f71d5 ast: extend Kinds to cover channels and goroutines 2018-03-12 11:12:21 +01:00
Marc Vertes
ed6399c15f ast: simplify addChild() 2018-03-10 12:42:03 +01:00
Marc Vertes
08ddc4518c Fix var declaration 2018-03-07 14:13:28 +01:00
Marc Vertes
16bb140d50 improve var declarations (in progress) 2018-03-07 09:13:32 +01:00
Marc Vertes
750f6e30e7 cfg: many improvements in struct management 2018-03-05 17:17:53 +01:00
Marc Vertes
af0fed0cf7 cfg: improve type propagation and struct / array definition 2018-03-01 18:56:09 +01:00
Marc Vertes
33d19bf2a5 Implement access to struct fields, (1 level only for now) 2018-02-27 17:23:47 +01:00
Marc Vertes
045fcd6d66 struct type support, in progress 2018-02-26 19:00:30 +01:00
Marc Vertes
31bdcefff5 Add struct and composite types, in progress 2018-02-26 09:21:58 +01:00
Marc Vertes
a2f37ea5bc add support for composite types, in progress 2018-02-22 17:02:02 +01:00
Marc Vertes
bb63091920 fix basic types, fix _return 2018-02-21 23:04:04 +01:00
Marc Vertes
835dd9c805 Add switch/case support. Some corner cases still missing 2018-02-21 13:23:20 +01:00
Marc Vertes
9b92ceb79f Add logical AND and OR statements 2018-02-20 19:15:50 +01:00
Marc Vertes
41bd7a8505 Refactoring of AST is now ok 2018-02-20 17:11:18 +01:00
Marc Vertes
20753f94e3 Refactor cfg creation, in progress 2018-02-16 23:19:18 +01:00