You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
1.9 KiB
Plaintext

If-Statements
======
if a == "test" then
print "test"
else
print "no test"
if 1 != 1 then {
let a = 1
a + 1
}
let value =
if a == b then
a
else
b
======
(file
(statement
(expr
(if
(expr
(infix_expr
(ident: "a")
(operator: "==")
(literal
(string: "test")
)
)
)
(expr
(call_expr
(ident: "print")
(literal
(string: "test")
)
)
)
(expr
(call_expr
(ident: "print")
(literal
(string: "no test")
)
)
)
)
)
)
(statement
(expr
(if
(expr
(infix_expr
(literal
(integer: "1")
)
(operator: "!=")
(literal
(integer: "1")
)
)
)
(expr
(block
(statement
(decl
(ident: "a")
(expr
(literal
(integer: "1")
)
)
)
)
(statement
(expr
(infix_expr
(ident: "a")
(operator: "+")
(literal
(integer: "1")
)
)
)
)
)
)
)
)
)
(statement
(decl
(ident: "value")
(expr
(if
(expr
(infix_expr
(ident: "a")
(operator: "==")
(ident: "b")
)
)
(expr
(ident: "a")
)
(expr
(ident: "b")
)
)
)
)
)
(EOI: "")
)