LWN.net Logo

Why learn C? (O'Reilly Radar)

Why learn C? (O'Reilly Radar)

Posted Jul 2, 2012 20:36 UTC (Mon) by tjc (subscriber, #137)
In reply to: Why learn C? (O'Reilly Radar) by HelloWorld
Parent article: Why learn C? (O'Reilly Radar)

The type specifier in a C declaration acts as a surrogate for the missing 'var' or 'func' keyword, which makes it possible for the parser to recognize the declaration without requesting a lot of extra tokens from the lexer.


(Log in to post comments)

Why learn C? (O'Reilly Radar)

Posted Jul 2, 2012 21:23 UTC (Mon) by HelloWorld (guest, #56129) [Link]

I think that this is only a problem when using top-down parsers. A bottom-up parser should handle this situation easily.

Why learn C? (O'Reilly Radar)

Posted Jul 3, 2012 15:46 UTC (Tue) by tjc (subscriber, #137) [Link]

Yes, it could be made to work, but it would have to be a backtracking parser, and it would probably be slow. Most bottom-up parsers (such as those produced by bison) are LALR(1), which only has one token look-ahead.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds