Mercury library 1.0 Translation of CFG grammars into an object model (Bachelor's thesis).

- Main Page
- Packages
- Classes
- Files

- File List

All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
LanguageInfo.cs
Go to the documentation of this file.
1 using Mercury.Scanning;
2 using Mercury.Interpreting;
3 using Mercury.Syntax;
4 using System;
5
6 namespace Mercury
7 {
13 public class LanguageInfo<T>
14 where T : class
15 {
16 //--[ Constructors ]-------------------------------------------------
17
27 public LanguageInfo(string name,
28 ITokenizer tokenizer, IScanner scanner,
29 Grammar grammar, RewriteRuleCollection<T> rwrules)
30 {
31 if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Name is not valid");
32
33 Tokenizer = tokenizer;
34 Scanner = scanner;
35 Grammar = grammar;
36 RewriteRules = rwrules;
37 Name = name;
38 }
39
40 //--[ Properties ]---------------------------------------------------
41
43 public ITokenizer Tokenizer { get; private set; }
44
46 public IScanner Scanner { get; private set; }
47
49 public Grammar Grammar { get; private set; }
50
52 public RewriteRuleCollection<T> RewriteRules { get; private set; }
53
55 public string Name { get; private set; }
56 }
57 }
Mercury.Scanning.Tokenizer
A default implementation of ITokenizer interface using Microsoft Regular Expressions. Splits tokens in the following fashion:
Definition: Tokenizer.cs:71
Mercury.Interpreting.RewriteRuleCollection< T >
A read-only collection of rewrite rules
Definition: RewriteRuleCollection.cs:14
Mercury.Scanning.ITokenizer
The tokenizer interface.
Definition: Tokenizer.cs:14
Mercury.Syntax.IScanner
Scanner scans input tokens and creates additional rules for parsing.
Definition: Scanner.cs:20
Mercury.LanguageInfo< T >.LanguageInfo
LanguageInfo(string name, ITokenizer tokenizer, IScanner scanner, Grammar grammar, RewriteRuleCollection< T > rwrules)
Initializes a new instance of the LanguageInfo{T} class.
Definition: LanguageInfo.cs:27
Mercury.Syntax.Grammar
Represents a Context-Free Grammar. This is an immutable class, to create a grammar use Mercury...
Definition: Grammar.cs:18