Example #1
0
        public static void lPush(Symbol symbol, Token token, string scope)
        {
            SAR temp = new Compiler.SAR(SAR.SARtype.Literal, token, token.lexeme, scope);

            if (token.type == Token.Type.Number)
            {
                temp.dataType = "int";
            }
            else if (token.type == Token.Type.Character)
            {
                temp.dataType = "char";
            }
            else if (token.type == Token.Type.BoolSymbol || token.lexeme == "true" || token.lexeme == "false")
            {
                temp.dataType = "bool";
            }
            else if (token.lexeme == "null")
            {
                temp.dataType = "null";
            }
            else
            {
                SemanticLiteralError(token);
            }
            temp.symid = symbol.symid;
            SAS.Push(temp);
        }
Example #2
0
        public static void vPush(Symbol s, Token t, string scope)
        {
            SAR sar = new Compiler.SAR(SAR.SARtype.Identifier, t, s.value, scope);

            sar.dataType = s.data[0].Split(':')[1];
            sar.symid    = s.symid;
            SAS.Push(sar);
            variableInit = true;
        }
Example #3
0
        public static void iPush(Token token, string scope)
        {
            SAR temp = new Compiler.SAR(SAR.SARtype.Identifier, token, token.lexeme, scope);

            SAS.Push(temp);
        }