PIF & ST

Input:

→ source.txt

→ list of token

// source.txt
VAR a: Integer;
    b: Integer;
    c: String;
BEGIN
	a := 1;
	b := a+2;
	WRITE(”c=”);
	WRITE(c);
END

Output:

→ PIF + ST + lex. error (if any)

PIF(token, ST_pos)

token ST_pos
VAR -1
id 0
: -1
integer -1
; -1
\n
b
:
integer
;
\n
c
:
string
;
\n
BEGIN
\n

ST(ST_pos, symbol) only id & constants

ST_pos symbol
0 a