Hacker News new | ask | show | jobs
by zabzonk 660 days ago
well, that's like saying the compiler when it sees something like:

   int x;
   x = 1;
it has to keep track of "x". of course it does. what programming languages don't?
1 comments

The weird thing about C is the syntax does not clearly identify which tokens refer to types and which tokens refer to other things. A statement like `myint x` is only a variable declaration if `myint` is a type, which means in order to identify a variable declaration, you have to know the complete set of named types, so constructing an AST requires keeping track of types.
Yeah, it's a really weird thing when you look into the yacc grammar of a C compiler.