Compiler: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 9: | Line 9: | ||
<pre> | <pre> | ||
\tif (i == j)\n\t\tz = 0;\n\telse\n\t\tz = 1; | \tif (i == j)\n\t\tz = 0;\n\telse\n\t\tz = 1; | ||
</pre> | |||
== Token Class == | |||
Identifier, keywords, '(', ')', Numbers, ... | |||
* Token classes correspond to sets of strings. | |||
* Identifier: A1, Foo, B17 | |||
* Integer: 0, 99 | |||
* Keyword: 'else' or 'if' or 'begin' or ... | |||
* Whitespace: if___else | |||
* Classify program substrings according to role | |||
* Communicate tokens to the parser | |||
<pre> | |||
Token | |||
string ---> Lexical Analysis -------> Parser | |||
</pre> | </pre> | ||
Revision as of 12:28, 26 November 2014
Lexical Analysis
if (i == j) z = 0; else z = 1;
is indeed below in computers
\tif (i == j)\n\t\tz = 0;\n\telse\n\t\tz = 1;
Token Class
Identifier, keywords, '(', ')', Numbers, ...
- Token classes correspond to sets of strings.
- Identifier: A1, Foo, B17
- Integer: 0, 99
- Keyword: 'else' or 'if' or 'begin' or ...
- Whitespace: if___else
- Classify program substrings according to role
- Communicate tokens to the parser
Token string ---> Lexical Analysis -------> Parser
Parsing
Semantic Analysis
Optimization
Code Generation
Resource
- coursera.org