ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
if_then.c File Reference
#include "../../ugbc.h"

Go to the source code of this file.

Functions

void if_then (Environment *_environment, char *_expression)
 Emit ASM code for IF ... THEN ....

Function Documentation

◆ if_then()

void if_then ( Environment * _environment,
char * _expression )

Emit ASM code for IF ... THEN ....

This function outputs the code to implement the conditional jump. This implementation assumes that an expression passed as a parameter is 0 (for false) and not zero (for true). In this case, if the expression is zero, it jumps directly to the statement following the corresponding ENDIF (or ELSE, if present). Otherwise, the following code will be executed (up to ENDIF). Since the compiler acts with a single pass, it is necessary to keep the information on the last used label. For this purpose, the label where it will jump will be inserted in the stack, so that it is defined at the moment when the ENDIF instruction will be examined.

Parameters
_environmentCurrent calling environment
_expressionExpression with the true / false condition

Definition at line 123 of file if_then.c.