Grammar Fragment English Explanation Formal IL (Allison) TBIL (Pittman)
line::= Tiny Basic reads lines GETLINE GL
number possibly with a line number in front TSTL <label> BN <label>
-- insert numbered statement into program INSERT IL
* repeat as needed JMP <label> BR <label>
statement do whatever the statement rule says to do STMT: <label> :STMT
PRINT is this keyword "PRINT"? TST S8,'PRINT' BC SKIP "PR"
expr-list::= this is what you can print… --
string quoted string TST S7,'"'; PRS BC P7 '"'; PQ
expression do the expression evaluation rule CALL EXPR JS EXPR
-- print the resulting value PRN PN
IF is this keyword "IF"? TST S9,'IF' BC INPT "IF"
relop do compare operator rule CALL RELOP JS RELO
THEN error if this in not keyword "THEN"? TST S17,'THEN' BC I1 "THEN"
statement do whatever the statement rule says to do JMP STMT J STMT
GOTO is this keyword "GOTO"? if not, try another TST S3,'GO'; TST S2,'TO' BC PRNT "GO"; BC GOSB "TO"
expression do the expression evaluation rule CALL EXPR JS EXPR
-- error if not end of statement DONE BE *
-- find that line in the program, do it next XPER GO
LET is this keyword "LET"? if not, try another TST S1,'LET' BC GOTO "LET"
var save variable name; error if none TSTV S17 BV *
= error if there is no "=" here TST S17,'=' BC * "="
expression do the expression evaluation rule CALL EXPR JS EXPR
-- error if not end of statement DONE BE *
-- store the value into the variable STORE SV
-- resume with next line XPER NX

Table 1: Partial correlation between Grammar, English pseudocode, and Interpreter Language. Grammar elements in the left column, represented by English pseudocode in the next column, then IL equivalents in the last two columns, Allison's then mine.

Back to Article