🖼️

Lexer and parser example for C. Starting from the sequence of characters “if(net>0.0)total+=net﹡(1.0+tax/100.0);”, the scanner composes a sequence of tokens, and categorizes each of them, for example as identifier, reserved word, number literal, or operator. The latter sequence is transformed by the parser into a syntax tree, which is then treated by the remaining compiler phases. The scanner and parser handles the regular and properly context-free parts of the grammar for C, respectively.

(echo:: @ ᯤ)