Compiler/lexical analyzer: Difference between revisions
Content added Content deleted
m (Use entity for ; under symbols, so that it aligns left.) |
m (Better regular expressions for character and string literals.) |
||
Line 58: | Line 58: | ||
| } || right brace || Rbrace |
| } || right brace || Rbrace |
||
|- |
|- |
||
| ; |
| ; || semi colon || Semi |
||
|- |
|- |
||
| , || comma || Comma |
| , || comma || Comma |
||
Line 86: | Line 86: | ||
| integers || [0-9]+ || Integer |
| integers || [0-9]+ || Integer |
||
|- |
|- |
||
| char literal || ' |
| char literal || <pre>'([^'\n]|\\n|\\\\)'</pre> || Integer |
||
|- |
|- |
||
| identifiers || [_a-zA-Z][_a-zA-Z0-9] |
| identifiers || [_a-zA-Z][_a-zA-Z0-9]* || Ident |
||
|- |
|- |
||
| string literal || " |
| string literal || "[^"\n]*" || String |
||
|} |
|} |
||
Line 182: | Line 182: | ||
! Output |
! Output |
||
|- |
|- |
||
| style="vertical-align:top" | |
| style="vertical-align:top" | |
||
<lang c> |
<lang c> |
||
/* |
/* |