예제 #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;
 }