2023-10-18 21:52:56 +00:00
|
|
|
==================
|
|
|
|
Simple Statements
|
|
|
|
==================
|
|
|
|
|
|
|
|
1
|
|
|
|
"one"
|
|
|
|
x
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
(root
|
2023-10-31 13:31:10 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(identifier)))))
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
==================
|
|
|
|
Simple Assignment
|
|
|
|
==================
|
|
|
|
|
|
|
|
x = 1
|
|
|
|
y = "one"
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
(root
|
2023-10-31 13:31:10 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))))
|
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))))
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
==================
|
|
|
|
Complex Assignment
|
|
|
|
==================
|
|
|
|
|
2023-10-31 09:51:37 +00:00
|
|
|
x = if 1 + 1 == 2 {
|
|
|
|
'yo'
|
|
|
|
} else {
|
|
|
|
'no'
|
|
|
|
}
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
(root
|
2023-10-31 13:31:10 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(if_else
|
|
|
|
(if
|
2023-10-18 21:52:56 +00:00
|
|
|
(expression
|
2023-10-31 13:31:10 +00:00
|
|
|
(logic
|
|
|
|
(expression
|
|
|
|
(math
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))
|
|
|
|
(logic_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))
|
|
|
|
(else
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))))))))))
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
==================
|
|
|
|
Expression Precedence
|
|
|
|
==================
|
|
|
|
|
2023-10-31 09:51:37 +00:00
|
|
|
x = 3 == 1 + 2 + 2
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
(root
|
2023-10-31 13:31:10 +00:00
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(logic
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(logic_operator)
|
|
|
|
(expression
|
|
|
|
(math
|
|
|
|
(expression
|
|
|
|
(math
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))))))))))
|