, PHP, , ( , ), . PHP- :
def execute_program(prog)
for statement in prog.toplevel_statements:
execute_statement(statement)
def execute_statement(statement):
if statement is an echo statement:
print( evaluate_expression(statement.argument) )
else if statement is a for loop:
execute_statement(statement.init)
while evaluate_expression(statement.condition).is_truthy():
for inner_statement in statement.body:
execute_statement(inner_statement)
execute_statement(statement.increment)
else if ...
, if-else-if AST, .
, , : " , ..".
, , , , , , "", . CPU , "", - if user_input == rectangle: [code to draw a rectangle] , .