Ejemplo n.º 1
0
 public Lexer()
 {
     LexerInfoTable = new InfoTable();
     // Experimental thing
     // I add some lexems, that my grammar consist of, to info table beforehand
     LexerInfoTable.AddKeyword(_keywords);
     LexerInfoTable.AddLongDelimiter(_longDelimiters);
     LexerInfoTable.AddShortDelimiter(new List <string>
     {
         ";", ".", "=", "<", ">"
     });
 }
Ejemplo n.º 2
0
        public Parser(List <Token> tokens, InfoTable infoT)
        {
            _tokens        = tokens;
            _infoTable     = infoT;
            _grammarLexems = new Dictionary <string, int>();

            List <KeyValuePair <string, int> > list = new List <KeyValuePair <string, int> >();

            list = infoT.GetKeywords()
                   .Concat(infoT.GetShortDelimiters())
                   .Concat(infoT.GetLongDelimiters())
                   .ToList();
            foreach (KeyValuePair <string, int> kv in list)
            {
                _grammarLexems.Add(kv.Key, kv.Value);
            }
        }
Ejemplo n.º 3
0
 public Parser()
 {
     _tokens        = new List <Token>();
     _infoTable     = new InfoTable();
     _grammarLexems = new Dictionary <string, int>();
 }
Ejemplo n.º 4
0
 public Lexer(InfoTable infoT)
 {
     LexerInfoTable = infoT;
 }