[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
Parsers-And-Lexers-in-C
This tutorial is an update of an older article i have submitted as a link. Now its fully published at Codepedia.
1. Parsers
Parsers are a formal algorithm, or finite automate, that checks a given input if it mathes the predefined operations.
For example the parser of the C compiler checks, if all statements written in a header or source file match with the valid patterns as defined in the grammar of C programming language. ยด
The following code snippet shows valid patterns - or tokens - of C programming language:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
Parsers-And-Lexers-in-C
Parsers and Lexers in C
-----------------------------This tutorial is an update of an older article i have submitted as a link. Now its fully published at Codepedia.
Understanding Parsers & Lexers
Before implementing a Parser or Lexer in C/C++ one needs to know how Parsers and Lexers basically work. Also one needs to know the differences between Parsers and lexers.1. Parsers
Parsers are a formal algorithm, or finite automate, that checks a given input if it mathes the predefined operations.
For example the parser of the C compiler checks, if all statements written in a header or source file match with the valid patterns as defined in the grammar of C programming language. ยด
The following code snippet shows valid patterns - or tokens - of C programming language:
/* defines N as 100 */int main(int argc, char* argv[]) { int i = 0; /*i initialized with 0 */ while(i < 10) /* increment i untill it equals 9 */ i++; double k = 3.1475; /*define k as Pi */ return 0; }
- define N 100
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
