Questions tagged [tinypg]

TinyPG (Tiny Parser Generator) is a small simple LL(1) recursive descent parser generator that generates C# or VB code from a simple grammar. It was written by Herre Kuijpers.

There is much more to read at the CodeProject page for TinyPg. Here is the introduction

@TinyPG stands for "a Tiny Parser Generator". This particular generator is an LL(1) recursive descent parser generator. This means that instead of generating a state machine out of a grammar like most compiler compilers, it will generate source code directly; basically generating a method for each non-terminal in the grammar. Terminals are expressed using .NET's powerful Regular Expressions. To help the programmer create .NET Regular Expressions, a Regular Expression (Regex) tool is embedded in TinyPG. Grammars can be written using the extended BNF notation.

These are the key features of TinyPG:

  • Provides syntax and semantics checking of the grammar
  • Generates a tiny set of sources for the parser/scanner/parsetree (just three .cs or .vb files without any external dependencies)
  • Allows each generated file to remain clearly human readable, and debuggable with Visual Studio(!)
  • Includes an expression evaluation tool that generates a traversable parse tree has the option to include C# code blocks
  • Inside the grammar, adding immediate functionality with just a few lines of code
  • Includes a tiny regular expression tool tries to keep things as simple and tiny as possible
7 questions
5
votes
1 answer

What is TinyPG and how does it work?

What is TinyPG and how does it work? I know its a "compiler-compiler" but how do I get started and create my own compiler in C#?
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
2
votes
1 answer

Use existing languages in BNF with TinyPG?

How can I use these BNF grammars which are in GOLD meta-syntax (RegExp + BNF) with TinyPG? I'm new to BNF so approximately what sort of conversion will I have to do to convert BNF to EBNF? I believe it should be pretty simple since TinyPG needs…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
2
votes
1 answer

BNF grammar that has sections with no ending?

I need to parse a simple proprietary language that I didn't design, so I can't change the language. I need the results in C#, so I've been using TinyPG because it's so easy to use, and doesn't require external libraries to run the parser. TinyPG…
Jim
  • 651
  • 2
  • 7
  • 15
2
votes
1 answer

TinyPG doesn't properly parse this grammar, bug or bad grammar?

I need to parse a simple language that I didn't design, so I can't change the language. I need the results in C#, so I've been using TinyPG because it's so easy to use, and doesn't require external libraries to run the parser. Things had been going…
Jim
  • 651
  • 2
  • 7
  • 15
0
votes
1 answer

How do you modify this script to run TinyPNG on opened files instead of having to use the open dialog to select a file?

I'm trying to modify this script to compress and then close all the opened files with the TinyPNG Photoshop plugin as opposed to having to choose one file at a time in an open dialog box. They do offer another script that allows you to compress a…
0
votes
1 answer

Parse lambda calculus style function applications with LL1 parser

I'm using TinyPG, which is an LL1 parser generator, to parse lambda calculus. I'm trying to write a rule that will parse function application like (a b) or (a b c) and so on. So far I have this rule (a bit simplified): APPLICATION -> LPARENTHESES…
Juan
  • 15,274
  • 23
  • 105
  • 187
0
votes
1 answer

TinyPG Function Implementation

Recently I've been very interested in parser generators and compiler compilers. To play around, I downloaded TinyPG and now have a simple language to parse strings and floats. Now, I'm curious about implementing simple functions with parameters. I…
Blue0500
  • 715
  • 8
  • 16