[fine] Compile iteratively instead of recursively

This commit is contained in:
John Doty 2024-01-16 09:26:05 -08:00
parent 7fb88ef199
commit 01798236ec
6 changed files with 68 additions and 52 deletions

View file

@ -61,6 +61,11 @@ fun test() -> f64 {
// | RightBrace:'"}"'
// |
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// | function foo (1 args, 0 locals):
// | strings (0):
// | code (4):
@ -72,12 +77,7 @@ fun test() -> f64 {
// | strings (0):
// | code (4):
// | 0: PushFloat(1.0)
// | 1: LoadFunction(0)
// | 1: LoadFunction(1)
// | 2: Call(1)
// | 3: Return
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// |

View file

@ -39,6 +39,11 @@ fun test() -> f64 {
// | RightBrace:'"}"'
// |
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// | function test (0 args, 0 locals):
// | strings (0):
// | code (10):
@ -52,9 +57,4 @@ fun test() -> f64 {
// | 7: FloatMultiply
// | 8: FloatAdd
// | 9: Return
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// |

View file

@ -4,12 +4,12 @@ fun test() {
// @no-errors
// @compiles-to:
// | function test (0 args, 0 locals):
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// | function << module >> (0 args, 0 locals):
// | function test (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing

View file

@ -4,6 +4,11 @@ fun test() -> bool {
// @no-errors
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// | function test (0 args, 0 locals):
// | strings (0):
// | code (15):
@ -22,11 +27,6 @@ fun test() -> bool {
// | 12: PushTrue
// | 13: BoolNot
// | 14: Return
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// |
// @eval: Bool(false)
// @type: 15 bool

View file

@ -57,6 +57,11 @@ fun test() -> f64 {
// | RightBrace:'"}"'
//
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// | function test (0 args, 0 locals):
// | strings (1):
// | 0: "discarded"
@ -69,10 +74,5 @@ fun test() -> f64 {
// | 5: Jump(7)
// | 6: PushFloat(45.0)
// | 7: Return
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// |
// @eval: Float(23.0)