oden/fine/tests/expression/variable.fine
John Doty 5ebede4a21 [fine] Gobs of work
- Assertion improvements
- Type check function calls
- Functions in the environment
- Compile function calls
2024-01-13 08:12:39 -08:00

62 lines
1.4 KiB
Text

let x = 23;
let y = x * 2;
let z = print(y);
z;
// @type: 41 f64
// @concrete:
// | File
// | LetStatement
// | Let:'"let"'
// | Identifier:'"x"'
// | Equal:'"="'
// | LiteralExpression
// | Number:'"23"'
// | Semicolon:'";"'
// | LetStatement
// | Let:'"let"'
// | Identifier:'"y"'
// | Equal:'"="'
// | BinaryExpression
// | Identifier
// | Identifier:'"x"'
// | Star:'"*"'
// | LiteralExpression
// | Number:'"2"'
// | Semicolon:'";"'
// | LetStatement
// | Let:'"let"'
// | Identifier:'"z"'
// | Equal:'"="'
// | CallExpression
// | Identifier
// | Identifier:'"print"'
// | ArgumentList
// | LeftParen:'"("'
// | Argument
// | Identifier
// | Identifier:'"y"'
// | RightParen:'")"'
// | Semicolon:'";"'
// | ExpressionStatement
// | Identifier
// | Identifier:'"z"'
// | Semicolon:'";"'
// |
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (12):
// | 0: PushFloat(23.0)
// | 1: StoreModule(0)
// | 2: LoadModule(0)
// | 3: PushFloat(2.0)
// | 4: FloatMultiply
// | 5: StoreModule(1)
// | 6: LoadModule(1)
// | 7: LoadExternFunction(0)
// | 8: Call(1)
// | 9: StoreModule(2)
// | 10: LoadModule(2)
// | 11: Discard
// |