5 ms·
A better example of C's context-sensitive grammar might be the expression "(T)*x", which parses differently depending on whether T names a type or a value.
by tom_ 5y ago
A better example of C's context-sensitive grammar might be the expression "(T)*x", which parses differently depending on whether T names a type or a value.
- yakubin 5y agoThat's a good example, but of a different thing. My examples show that the input is lexed differently based on what part of AST is being produced at a given point. Your example shows that input is parsed into different ASTs based on information from the type system. I.e my examples show that in C the lexer can't be separated from the parser, and your example shows that the parser can't be separated from the type system.