-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNEXT
70 lines (50 loc) · 2.42 KB
/
NEXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
+ make tokens unexported
+ handle division by zero
+ add line info from lex to eval errors
more on errors:
+ return all errors (modulo parser sync)
- when it's done, consider adding BCL to github.com/Boeing/config-file-validator
+ bin ops:
== != # for int float str bool
< > <= >= # for int float str
and or # for bool, short-circuit
- builtin functions:
- getenv(key)
- cmd(...) to run commands and catch the output!
- simple type conversions: 42 @str, expr @bool
- consider replacing cmd & type conversions with sigils
+ fix: when a field is defined more than once, only the last clause
is evaluated; should evaluate all then overwrite with the last one
(1. current behavior unintuitive, 2. prep for side-effect exprs like ++i)
= not occuring in the vm version
+ consider fields to be resolvable like vars in the scope of the current block;
then they would act like local vars
= done in the vm version
- lists - in two variants: with the same type and varying types
- as lists can be nested, there is a need to encode variety of such types
+ nested blocks; design carefully
= done in the vm version
~ ability to use reference to other block's field, possibly nested
= partly done in the vm version in the way that in the nested block expr can
refer to the field in any of the parend blocks; what remains to be done is:
- ability to use paths to all blocks/fields across the whole file
- unmarshaling options:
- allow fields to be missing in the target struct
- allow struct type to be named differently than block type
(at runtime, without struct tags)
+ vm impl
+ test cases for assignments inside expr, to demonstrate they are valid
- reflection: allow filling toplevel structs of different types
- when the language and vm is stable, port to Python, Ruby, Zig, ...
~ way to port in small steps is to make prog struct fully serializable
and port the vm first
- functions, frames, call stack, prog->chunks
- native functions
- can the approach "all vars are local" play well with functions and frames?
- reintroduce global & local vars; how does idents resolving play with fields?
- sort out scopes for processing multiple files (one prog vs many progs)
-> this will be easier after functions
- reflection: when there is inner non-anonymous struct and its type differs
from the block type, there is no way to bind it - struct tag is only about
the name/key
- marshal/dump, also with reflection