2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
Simple Statements
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
1
|
2023-10-31 20:25:13 +00:00
|
|
|
"one";
|
2023-10-18 21:52:56 +00:00
|
|
|
x
|
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer))))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(string))))
|
|
|
|
(statement
|
|
|
|
(expression
|
|
|
|
(identifier))))
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
Simple Assignment
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-10-31 20:25:13 +00:00
|
|
|
x = 1;
|
2023-10-18 21:52:56 +00:00
|
|
|
y = "one"
|
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(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
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
Complex Assignment
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-10-31 09:51:37 +00:00
|
|
|
x = if 1 + 1 == 2 {
|
|
|
|
'yo'
|
|
|
|
} else {
|
|
|
|
'no'
|
|
|
|
}
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(if_else
|
|
|
|
(if
|
|
|
|
(expression
|
|
|
|
(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
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
Expression Precedence
|
2023-11-11 01:44:03 +00:00
|
|
|
================================================================================
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-10-31 09:51:37 +00:00
|
|
|
x = 3 == 1 + 2 + 2
|
2023-10-18 21:52:56 +00:00
|
|
|
|
2023-11-11 01:44:03 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2023-10-18 21:52:56 +00:00
|
|
|
|
|
|
|
(root
|
2023-11-11 01:44:03 +00:00
|
|
|
(statement
|
|
|
|
(assignment
|
|
|
|
(identifier)
|
|
|
|
(assignment_operator)
|
|
|
|
(statement
|
|
|
|
(expression
|
2023-12-30 02:53:26 +00:00
|
|
|
(math
|
2023-11-11 01:44:03 +00:00
|
|
|
(expression
|
|
|
|
(math
|
|
|
|
(expression
|
2023-12-30 02:53:26 +00:00
|
|
|
(logic
|
2023-11-11 01:44:03 +00:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))
|
2023-12-30 02:53:26 +00:00
|
|
|
(logic_operator)
|
2023-11-11 01:44:03 +00:00
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
2023-12-30 02:53:26 +00:00
|
|
|
(integer)))))
|
|
|
|
(math_operator)
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(integer)))))))))
|