oden/fine/tests/expression/variable.fine

43 lines
923 B
Text

let x = 23;
let y = x * 2;
y;
// @type: 27 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:'";"'
// | ExpressionStatement
// | Identifier
// | Identifier:'"y"'
// | Semicolon:'";"'
// |
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (8):
// | 0: PushFloat(23.0)
// | 1: StoreModule(0)
// | 2: LoadModule(0)
// | 3: PushFloat(2.0)
// | 4: FloatMultiply
// | 5: StoreModule(1)
// | 6: LoadModule(1)
// | 7: Discard
// |