Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Reserved words are initialized from an imaginary source code.

What does it mean? Could you point to a place in the source?



I mean this part:

    p = "char else enum if int return sizeof while "
        "open read close printf malloc free memset memcmp exit void main";
    i = Char; while (i <= While) { next(); id[Tk] = i++; } // add keywords to symbol table
    i = OPEN; while (i <= EXIT) { next(); id[Class] = Sys; id[Type] = INT; id[Val] = i++; } // add library to symbol table
    next(); id[Tk] = Char; // handle void type
    next(); idmain = id; // keep track of main
Throughout the entire source code p is a source code pointer, but at the very beginning of the program it is a string containing all reserved words and library functions, and they are read with the same lexing function `next` to the symbol table before the memory for the actual source code is allocated.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: