parser: define symbols and scopes and detect typedefs