File:Xxx Scanner and parser example for C.gif

From Infogalactic: the planetary knowledge core
Jump to: navigation, search
Original file(1,033 × 715 pixels, file size: 9 KB, MIME type: image/gif)

Summary

<a href="https://en.wikipedia.org/wiki/Lexical_analysis" class="extiw" title="en:Lexical analysis">Scanner</a> and <a href="https://en.wikipedia.org/wiki/Parsing" class="extiw" title="en:Parsing">parser</a> example for <a href="https://en.wikipedia.org/wiki/C_(programming_language)" class="extiw" title="en:C (programming language)">C</a>. Starting from the sequence of characters "if(net>0.0)total+=net*(1.0+tax/100.0);", the scanner composes a sequence of <a href="https://en.wikipedia.org/wiki/Lexical_analysis#token" class="extiw" title="en:Lexical analysis">tokens</a>, and categorizes each of them, e.g. as identifier, reserved word, number literal, or operator. The latter sequence is transformed by the parser into a <a href="https://en.wikipedia.org/wiki/abstract_syntax_tree" class="extiw" title="en:abstract syntax tree">syntax tree</a>, which is then treated by the remaining <a href="https://en.wikipedia.org/wiki/Compiler#Structure_of_a_compiler" class="extiw" title="en:Compiler">compiler phases</a>. The scanner and parser handles the <a href="https://en.wikipedia.org/wiki/regular_grammar" class="extiw" title="en:regular grammar">regular</a> and properly <a href="https://en.wikipedia.org/wiki/context-free_grammar" class="extiw" title="en:context-free grammar">context-free</a> parts of the <a href="https://en.wikipedia.org/wiki/C_syntax#External_links" class="extiw" title="en:C syntax">grammar for C</a>, respectively.

Licensing

Lua error in package.lua at line 80: module 'strict' not found.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current19:38, 7 January 2017Thumbnail for version as of 19:38, 7 January 20171,033 × 715 (9 KB)127.0.0.1 (talk)<a href="https://en.wikipedia.org/wiki/Lexical_analysis" class="extiw" title="en:Lexical analysis">Scanner</a> and <a href="https://en.wikipedia.org/wiki/Parsing" class="extiw" title="en:Parsing">parser</a> example for <a href="https://en.wikipedia.org/wiki/C_(programming_language)" class="extiw" title="en:C (programming language)">C</a>. Starting from the sequence of characters "<code>if(net>0.0)total+=net*(1.0+tax/100.0);</code>", the scanner composes a sequence of <a href="https://en.wikipedia.org/wiki/Lexical_analysis#token" class="extiw" title="en:Lexical analysis">tokens</a>, and categorizes each of them, e.g. as <span style="background:transparent;color: #800000;" title="transparent">identifier</span>, <span style="background:transparent;color: #808000;" title="transparent">reserved word</span>, <span style="background:transparent;color: #008000;" title="transparent">number literal</span>, or <span style="background:transparent;color: #000080;" title="transparent">operator</span>. The latter sequence is transformed by the parser into a <a href="https://en.wikipedia.org/wiki/abstract_syntax_tree" class="extiw" title="en:abstract syntax tree">syntax tree</a>, which is then treated by the remaining <a href="https://en.wikipedia.org/wiki/Compiler#Structure_of_a_compiler" class="extiw" title="en:Compiler">compiler phases</a>. The scanner and parser handles the <a href="https://en.wikipedia.org/wiki/regular_grammar" class="extiw" title="en:regular grammar">regular</a> and properly <a href="https://en.wikipedia.org/wiki/context-free_grammar" class="extiw" title="en:context-free grammar">context-free</a> parts of the <a href="https://en.wikipedia.org/wiki/C_syntax#External_links" class="extiw" title="en:C syntax">grammar for C</a>, respectively.
  • You cannot overwrite this file.

The following page links to this file: