66 lines
1.6 KiB
Plaintext
66 lines
1.6 KiB
Plaintext
================================================================================
|
|
While Loop
|
|
================================================================================
|
|
|
|
while true {
|
|
(output "This is a bad idea...")
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(block
|
|
(statement
|
|
(while
|
|
(expression
|
|
(value
|
|
(boolean)))
|
|
(block
|
|
(statement
|
|
(expression
|
|
(function_call
|
|
(built_in_function
|
|
(expression
|
|
(value
|
|
(string))))))))))))
|
|
|
|
================================================================================
|
|
Nested While Loop
|
|
================================================================================
|
|
|
|
while (true) {
|
|
while (x > 0) {
|
|
x -= 1
|
|
}
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(block
|
|
(statement
|
|
(while
|
|
(expression
|
|
(value
|
|
(boolean)))
|
|
(block
|
|
(statement
|
|
(while
|
|
(expression
|
|
(logic
|
|
(expression
|
|
(identifier))
|
|
(logic_operator)
|
|
(expression
|
|
(value
|
|
(integer)))))
|
|
(block
|
|
(statement
|
|
(assignment
|
|
(identifier)
|
|
(assignment_operator)
|
|
(statement
|
|
(expression
|
|
(value
|
|
(integer))))))))))))))
|