diff options
| author | Antonio Navarro Perez <antnavper@gmail.com> | 2024-03-12 15:23:18 +0100 |
|---|---|---|
| committer | Antonio Navarro Perez <antnavper@gmail.com> | 2024-03-12 15:23:18 +0100 |
| commit | ee283aba92757f3661e6bb1cc746e8bb5efff884 (patch) | |
| tree | e0e9729e5bd2bd15c6527ae1e474ff5a1a1c8f96 | |
| parent | 6a32a7bc5f6320902cd5c2910a1353a0f7039237 (diff) | |
Fix: small README fixes and throw an error if expression not supported.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
| -rw-r--r-- | parser/README.md | 2 | ||||
| -rw-r--r-- | parser/expr.go | 3 | ||||
| -rw-r--r-- | vm/README.md | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/parser/README.md b/parser/README.md index 118d9aa..b233248 100644 --- a/parser/README.md +++ b/parser/README.md @@ -13,7 +13,7 @@ The input of parser is a list of tokens produced by the scanner. Multiple tokens are processed at once. The minimal set to get meaningful results (not an error or nil) is a complete statement. -The output of parser is also a list of tokens, to be consummed by +The output of parser is also a list of tokens, to be consumed by the compiler to produce bytecode. The output tokens set is identical to the bytecode instructions set except that: diff --git a/parser/expr.go b/parser/expr.go index 806fd75..45eb880 100644 --- a/parser/expr.go +++ b/parser/expr.go @@ -1,6 +1,7 @@ package parser import ( + "fmt" "log" "strconv" @@ -86,6 +87,8 @@ func (p *Parser) ParseExpr(in Tokens) (out Tokens, err error) { out = append(out, t) vl++ ops = append(ops, scanner.Token{Str: "index", Id: lang.Index, Pos: t.Pos}) + default: + return nil, fmt.Errorf("expression not supported yet: %q", t.Str) } if len(selectors) > 0 { out = append(out, selectors...) diff --git a/vm/README.md b/vm/README.md index 92b1ac8..ee550a2 100644 --- a/vm/README.md +++ b/vm/README.md @@ -28,7 +28,7 @@ Structurally, the vm implements logical and arithmetic operators, condional jumps for `if`, `for` and `switch` control flow, and function call, return and frame management. -the memory state of the vm is a slice of Go interfaces (`[]any`). +the memory state of the vm is a slice of (`[]reflect.Value`). The whole vm is coded in a single function of 80 lines with no dependencies. The size will grow as we add missing instructions, but the |
