DoctorWkt / acwj

A Compiler Writing Journey
GNU General Public License v3.0
10.61k stars 1.03k forks source link

In section 19(Array), we should check the use of array name. #57

Open co-neco opened 1 year ago

co-neco commented 1 year ago

In expr.c file:

static struct ASTnode *primary(void) { ... id = findglob(Text); if (id == -1) fatals("Unknown variable", Text);

if (Gsym[id].stype == S_ARRAY)
    n = mkastleaf(A_ADDR, Gsym[id].type, id);
else if (Gsym[id].stype != S_VARIABLE)
    fatals("Wrong stype of identifier", Text);

... }