diff options
| author | Marc Vertes <marc.vertes@tendermint.com> | 2023-10-12 10:51:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-12 10:51:58 +0200 |
| commit | 37b9da32d3b911091deb254f6cba2a137c471287 (patch) | |
| tree | b4451de0fa0473a937a77d39fd1f8a4f87c8f60d /testdata | |
| parent | a21b9b12ad865a19ff687645082f9093c4101039 (diff) | |
move to a direct byte code compiler (#8)
* 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
Diffstat (limited to 'testdata')
| -rw-r--r-- | testdata/add | 2 | ||||
| -rw-r--r-- | testdata/fib | 6 | ||||
| -rw-r--r-- | testdata/p00 | 1 | ||||
| -rw-r--r-- | testdata/p01 | 2 | ||||
| -rw-r--r-- | testdata/p02 | 7 | ||||
| -rw-r--r-- | testdata/p03 | 3 | ||||
| -rw-r--r-- | testdata/p04 | 4 | ||||
| -rw-r--r-- | testdata/p05 | 10 | ||||
| -rw-r--r-- | testdata/p06 | 7 | ||||
| -rw-r--r-- | testdata/p07 | 5 |
10 files changed, 0 insertions, 47 deletions
diff --git a/testdata/add b/testdata/add deleted file mode 100644 index a403485..0000000 --- a/testdata/add +++ /dev/null @@ -1,2 +0,0 @@ -func add(a int, b int) int { return a + b } -add(4, 3) diff --git a/testdata/fib b/testdata/fib deleted file mode 100644 index 654c5c0..0000000 --- a/testdata/fib +++ /dev/null @@ -1,6 +0,0 @@ -func fib(i int) int { - if i < 2 { return i } - return fib(i-2) + fib(i-1) -} - -println(fib(6)) diff --git a/testdata/p00 b/testdata/p00 deleted file mode 100644 index 19f5084..0000000 --- a/testdata/p00 +++ /dev/null @@ -1 +0,0 @@ -1+2 diff --git a/testdata/p01 b/testdata/p01 deleted file mode 100644 index baafaa9..0000000 --- a/testdata/p01 +++ /dev/null @@ -1,2 +0,0 @@ -s := "Hello" -println(s, 5+2) diff --git a/testdata/p02 b/testdata/p02 deleted file mode 100644 index 1aeb4a9..0000000 --- a/testdata/p02 +++ /dev/null @@ -1,7 +0,0 @@ -a := 1 - -if a < 2 { - println("yep") -} - -println("ok") diff --git a/testdata/p03 b/testdata/p03 deleted file mode 100644 index 39a3cda..0000000 --- a/testdata/p03 +++ /dev/null @@ -1,3 +0,0 @@ -func f(a int, b int) int { return a + b } - -println("f:", f(3, 4), f(5, 6)) diff --git a/testdata/p04 b/testdata/p04 deleted file mode 100644 index f2a85c8..0000000 --- a/testdata/p04 +++ /dev/null @@ -1,4 +0,0 @@ -func f() int { println(a) } - -a := 4 -f() diff --git a/testdata/p05 b/testdata/p05 deleted file mode 100644 index 51c2c9b..0000000 --- a/testdata/p05 +++ /dev/null @@ -1,10 +0,0 @@ -func f(i int) int { - if i < 2 { - if i == 1 { - return - } } - println("i", i) -} - -f(1) -println("bye") diff --git a/testdata/p06 b/testdata/p06 deleted file mode 100644 index 88029cc..0000000 --- a/testdata/p06 +++ /dev/null @@ -1,7 +0,0 @@ -func f(i int) { - if i < 2 { return } - println("i > 1:", i) -} - -f(1) -println("bye") diff --git a/testdata/p07 b/testdata/p07 deleted file mode 100644 index 2fa7ee0..0000000 --- a/testdata/p07 +++ /dev/null @@ -1,5 +0,0 @@ -func f1() { println("in f1") } - -func f2() { println("in f2"); f1() } - -f2() |
