What is TinyPG and how does it work?

What is TinyPG and how does it work? I know its "compiler-compiler", but how do I start and create my own compiler in C #?

+4
source share
1 answer

I understand how you use it, and here is a short one.

TinyPG is a complete Windows GUI compiler compiler for RegExp, EBNF, and C # / VB. The following describes the procedure for developing your own "compiler" in TinyPG:

You define terminals using Regular Expressions.

  • You write these ReyExps in TinyPG, which basically extracts tokens from the source code.
  • RegExps is supported in .NET, which means that even your generated "compiler" code uses .NET RegExps.

You define non-terminal and parser rules in the Extended BNF meta-syntax.

  • You write EBNF in TinyPG to describe the language of your choice.
  • Some free BNF Grammers that describe modern programming languages.

You define the compiler in managed code.

  • You write C # / VB code in TinyPG to convert markers to an output file of your choice.
  • One C # / VB code block for BNF grammar rule only.
  • TinyPG can compile and run your "tokenizer + parser + complier" using the command line compiler.

TinyPG generates C # code for your new “compiler”.

  • Generates parsing from the entered source code using your RegEx along with your EBNF.
  • Translates this parsing tree to output using C # / VB code.

You are developing the front-end of your compiler in C # or VB.NET.

  • The base interface will call the generated C # classes with the input file and display the output.

To get started, you can open the “simple expression2.tpg” file in the provided TinyPG samples to see a demo of the calculator compiler.

+8
source

All Articles