-
What's a parser?
What is it, what does it do?
-
Member
Re: What's a parser?
parser - Also known as a recognizer. A parser scans a stream of input tokens or lexemes that constitute a source file or program. The parser can build a symbol table and a parse tree, but it does not generate the object code that constitutes the compiled program. The important point is that a parser is not a compiler. A compiler usually consists of a front end (scanner and parser) as well as a back end (code optimizer and code generator). When processing an input stream, a parser recognizes higher level abstractions (lexemes and tokens) than a scanner which reads one character at at time.
~Guitarlynn
-
Re: What's a parser?
Technical definitions aside, what's the practical use of yacc & bison for example?
-
Member
Re: What's a parser?
Mostly it's used in Java, C, and XML to check certain strings
(example, url's in XML) and preprocess against the libraries
which outputs a more compatible syntax for the compiler.
It's is most commonly used for pre-compiling and error locating. In some parser setups, it simply kills whitespace and
comments, making a smaller, faster binary (It would have to be
big to be noticable in any case).
The best example I can think of put simply is like grep'ping
for a file you are trying to find, but more configurable like
sed.
~Guitarlynn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks