-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathParserHelper.cs
29 lines (27 loc) · 978 Bytes
/
ParserHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
namespace SimpleParser
{
public class LexException : Exception
{
public LexException(string msg) : base(msg) { }
}
public class SyntaxException : Exception
{
public SyntaxException(string msg) : base(msg) { }
}
// Класс глобальных описаний и статических методов
// для использования различными подсистемами парсера и сканера
public static class ParserHelper
{
}
public enum type { tint, tbool, tundefined };
public static class SymbolTable {
public static Dictionary<string, type> vars = new Dictionary<string, type>();
public static void NewVarDef(string name){
if (vars.ContainsKey(name))
throw new Exception("Variable " + name + " was described");
else vars.Add(name,type.tundefined);
}
}
}