Building a Simple Recursive Descent Parser (Completed Simple Parser)

In this post, I complete the recursive descent parser that will parse the simple grammar that I presented previously in this series.  In this post, I’ll examine in detail the NospaceExpression class, which needs to implement operator precedence. This blog is inactive.New blog: EricWhite.com/blog Blog TOCNote:  I have to apologize for the delay in writing…


Building a Simple Recursive Descent Parser (continued)

In this post, I further enhance the recursive descent parser that will parse the simple grammar that I presented previously in this series.  I’ll examine some more classes that represent symbols in that grammar.  The classes I present in this post further show how it’s possible to write LINQ code that closely parallels the grammar….


Building a Simple Recursive Descent Parser

In this post, I present the start of a recursive descent parser that will parse the simple grammar that I presented previously in this series.  I’ll point out some key features of the code so that it is easy to see how the code works. This blog is inactive.New blog: EricWhite.com/blog Blog TOCThis post is…


Creating a Collection from Singletons and Collections using LINQ

A key operation when doing pure functional transformations is the process of creating complex hierarchies of objects.  We see this when transforming some data source (such as an Open XML WordprocessingML document) to a LINQ to XML tree, and we see this when writing a recursive descent parser.  The recursive descent parser for Excel formulas…


Recursive Descent Parser: A Simple Grammar

To learn how recursive descent parsers work, it is helpful to implement a very simple grammar, so for pedagogical purposes, I’ve defined a grammar for simple arithmetic expressions. The parser will construct a syntax tree from expressions that we can then examine as necessary. Just for fun, after implementing the parser, we will write a…


Recursive Descent Parser using LINQ: The Augmented Backus-Naur Form Grammar

[Blog Map]  This blog is inactive.  New blog: EricWhite.com/blog A grammar is a device to define syntax for a language.  A grammar is made up of rules, sometimes called productions.  Each rule defines a symbol, when can then be further used in other rules.  Grammars are not hard to understand; most developers instinctively understand grammars when they…


Writing a Recursive Descent Parser using C# and LINQ

Recursive descent parsers are one of the easier types of parsers to implement.  Given a properly defined grammar, you write a class for each production in the grammar, and you write one fairly simple method in each class.  Each of those methods returns a ‘production’ based on its source productions (tokens) passed to it.  Once…