Archive

Posts Tagged ‘grammar’

How to create an abstract syntax tree while parsing an input stream.

May 25, 2014 2 comments

In this article I’ll show you how you can create the abstract syntax tree (AST) of an input stream while parsing it. A parser usually reads various tokens from its input by using a lexer as a helper coroutine and tries to match various grammar rules that specify the syntax of a language (the source language).

Read more…

Techniques for resolving common grammar conflicts in parsers.

May 17, 2014 Leave a comment

In this article I’ll present to you some common conflicts that usually occur in Bison grammars and ways of resolving these. At first, conflicts in Bison context are situations where a sequence of input can be parsed in multiple ways according to the specified BNF grammar rules.

Read more…

Using literal character tokens when designing lexers and parsers.

May 11, 2014 Leave a comment

Sometimes while I exploring the source code of various free software Flex lexers and Bison parsers I see name declarations for single character tokens.

Read more…