Пример #1
0
 public static NonTerm CreateTypeDecl(BaseSymbol typeToken)
 {
     return(new NonTerm(NonTermType.Type, typeToken));
 }
Пример #2
0
 public static void GetVarDecl(BaseSymbol nonTerm, out Token typeDeclaration, out Token id)
 {
     typeDeclaration = nonTerm.Symbols[0] as Token;
     id = nonTerm.Symbols[1] as Token;
 }
Пример #3
0
 public static NonTerm CreateNewStatement(BaseSymbol expression)
 {
     return(new NonTerm(NonTermType.NewStatement, expression));
 }
Пример #4
0
 public static void GetNewStatement(BaseSymbol nonTerm, out Token expression)
 {
     expression = nonTerm.Symbols[0] as Token;
 }
Пример #5
0
 public static void GetAssignVarStatement(BaseSymbol nonTerm, out BaseSymbol variable, out BaseSymbol expression)
 {
     variable   = nonTerm.Symbols[0];
     expression = nonTerm.Symbols[1];
 }
Пример #6
0
 public static void GetAssignIdStatement(BaseSymbol nonTerm, out Token idToken, out BaseSymbol expression)
 {
     idToken    = nonTerm.Symbols[0] as Token;
     expression = nonTerm.Symbols[1];
 }
Пример #7
0
 public static void GetWhileStatement(BaseSymbol nonTerm, out BaseSymbol expression, out BaseSymbol statement)
 {
     expression = nonTerm.Symbols[0];
     statement  = nonTerm.Symbols[1];
 }
Пример #8
0
 public static void GetPrintStatement(BaseSymbol nonTerm, out BaseSymbol expression)
 {
     expression = nonTerm.Symbols[0];
 }
Пример #9
0
        public static NonTerm CreateIfElseStatement(BaseSymbol expression, BaseSymbol statementIf, BaseSymbol statementElse)
        {
            List <BaseSymbol> declarations = new List <BaseSymbol>()
            {
                expression, statementIf, statementElse
            };

            return(new NonTerm(NonTermType.IfElseStatement, declarations));
        }
Пример #10
0
 public static void GetElseStatement(BaseSymbol nonTerm, out BaseSymbol statement)
 {
     statement = nonTerm.Symbols[2];
 }
Пример #11
0
 public static void GetFormalArgumentDeclaration(BaseSymbol nonTerm, out Token typeDeclaration, out Token argumentId)
 {
     typeDeclaration = nonTerm.Symbols[0] as Token;
     argumentId      = nonTerm.Symbols[1] as Token;
 }
Пример #12
0
 public static BaseSymbol CreateArrayDecl(BaseSymbol type, int arrayDimention)
 {
     (type as Token).CountArrayDimention = arrayDimention;
     return(type);
 }
Пример #13
0
 public static NonTerm CreateExtendsClause(BaseSymbol id)
 {
     return(new NonTerm(NonTermType.ExtendsClause, id));
 }
Пример #14
0
 public static void GetMethodDecl(BaseSymbol nonTerm, out Token typeDeclaration, out Token methodId,
                                  out List <BaseSymbol> variables, out BaseSymbol statements, out BaseSymbol returnExpression)
 {
     GetMethodSignature(nonTerm, out typeDeclaration, out methodId, out variables);
     statements       = nonTerm.Symbols[3];
     returnExpression = nonTerm.Symbols[4];
 }
Пример #15
0
 public static void GetMethodSignature(BaseSymbol nonTerm, out Token typeDeclaration, out Token methodId, out List <BaseSymbol> variables)
 {
     typeDeclaration = nonTerm.Symbols[0] as Token;
     methodId        = nonTerm.Symbols[1] as Token;
     variables       = nonTerm.Symbols[2].Symbols;
 }