This project is read-only.

Geting Started

Although the task of writing a parser is not so easy and requires you to know some parsing concepts, this parser is realy easy to use. We designed the library to be as simple as is possible and avoided using jargon. So you only need to design your language or analyze how your data structure can be parsed using the available functionalities in veparser.

The steps to write a parser using Ve Parser

  1. Add Ve Parser to your project:
    1. Download and reference the veparser.dll in your project.
    2. or simply using NuGet you only need to type Install-Package veparser
  2. Derive a class from TokenParser.
  3. Define your parser by implementing the abstract method GetRootParser.
  4. Tokenize your input text calling Lexer.Parse
  5. Call the Parse method of your parser calss.

How Tos

  • How to write a parser (comming soon..)
  • How to write my own Lexer/Tokenizer (coming soon...)
  • How to monitor parser execution (coming soon...)
  • How to debug the parser I wrote (coming soon...)


Is Ve Parser only for parsing programming languages?

Ve Parser is very tricky in its design and in its usage. You can use it for parsing a computer language, a data structure like CSV file, an xml data. So its up to you how to use it. In fact it consumes an IEnumerator of any arbitary data type(rather than char or string), so you can parse a list of data objects to see if they follow a special pattern or not.

What kind of grammar language do I have to wrote in order to utilise Ve Parser?

Ve Parser is a Combinatory Parser writen in C#, so the only thing you need is a .Net language. So you can write your grammar directly in your C# code and actualy your grammar is your parser and your parser is your grammar. Thats it, the grammar and the parser are the same thing.

Whats are Ve Parser requirements?

Due to implementatoin dependencies it is available only for .Net 4.0.


For now I am writing a brief description of the major combinators, to start the process of documentation. So be aware that this reference documentation is incomplete and I am looking after generating a comprehensive documentation which includes the cod XML documentations.
Lets start with some basic concepts:


Parser is a delegate defined as the very fundamental type for functions which will represent a parser or generator. This delegate signature is as follow:
public delegate bool Parser();
The delegate simply says that a Parser is a function that has no argument and return a true or false value. If the return value is true it means that the parser did it job successfully and if the return value is false it means the Parser failed to do its job.
I need to clarify here that the Parser finally will work on the input stream but for some reason which requires a separate page I did not set the input stream as the Parser's arguments. The toParser function will create a Parser from a TokenChecker but I tried to hide this function by layers of abstraction so from the perspective of end user, only we have a Parser concept.


Ve Parser is a combinatory parser, it works based on combination of parsers. You create more complex parsers by combining the more simpler parsers. You may begin with a simple parser that only expects the following input token(character or word) to be a special value and then create parsers which expect a sequence of some other things to appear in the input stream.

Lets follow the documentation with combinators, I am going to put them in the order of importance.


The input and output : This combinator receives a set of parsers in input and will returns a parser (Parser[] --> Parser).
When wins : The returned parser will success if it reaches a successful parser.
Purpose : To follow different options to parse the input, so it will allow the parser to find a expected input from a range of possibilities and follow the path for that kind of expected input. For example when parsing class members for C# language you may expect a field definition or you may expect a property definition, but in current position both are possible.


The input and output : This combinator receives a set of parsers in input and will returns a parser (Parser[] --> Parser).
When wins : The returned parser will success if all of the passed parsers run successfully one after one.
Purpose: So it will check to see if a sequence of expectations are satisfied by input.

Last edited Oct 20, 2011 at 3:14 PM by MeysamNaseri, version 3


No comments yet.