Changeset 3100

Show
Ignore:
Timestamp:
11/25/08 08:43:46 (12 months ago)
Author:
sukyoungryu
Message:

[ast refactoring] Eliminated AppExpr?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/astgen/Fortress.ast

    r3099 r3100  
    11131113                            _RewriteInstantiatedOpRefs(List<_RewriteOpRefOverloading> overloadings = Collections.<_RewriteOpRefOverloading>emptyList()); 
    11141114                    /** 
    1115                      * functional applicaiton 
    1116                      */ 
    1117                     abstract AppExpr(); 
     1115                     * juxtaposition of expressions 
     1116                     * If this node turns out to actually be a juxtaposition, 
     1117                     * based on the types, the op field is a reference to 
     1118                     * the operator that should be used. 
     1119                     * 
     1120                     * In order to know whether a juxtaposition is an infix or 
     1121                     * multifix juxtaposition, we need type information. 
     1122                     * 
     1123                     * After type checking, this node should disappear. 
     1124                     * 
     1125                     * Primary ::= Primary . Id StaticArgs? ParenthesisDelimited 
     1126                     *           | Primary TupleExpr 
     1127                     *           | Primary Primary 
     1128                     * e.g.) myString.replace("foo", "few") 
     1129                     * e.g.) log log n 
     1130                     */ 
     1131                    abstract Juxt(OpRef multiJuxt = ExprFactory.makeMultiJuxt(), 
     1132                                  OpRef infixJuxt = ExprFactory.makeInfixJuxt(), 
     1133                                  List<Expr> exprs = new LinkedList<Expr>()); 
    11181134                        /** 
    1119                          * juxtaposition of expressions 
    1120                          * If this node turns out to actually be a juxtaposition, 
    1121                          * based on the types, the op field is a reference to 
    1122                          * the operator that should be used. 
    1123                          * 
    1124                          * In order to know whether a juxtaposition is an infix or 
    1125                          * multifix juxtaposition, we need type information. 
    1126                          * 
    1127                          * After type checking, this node should disappear. 
    1128                          * 
    1129                          * Primary ::= Primary . Id StaticArgs? ParenthesisDelimited 
    1130                          *           | Primary TupleExpr 
    1131                          *           | Primary Primary 
    1132                          * e.g.) myString.replace("foo", "few") 
    1133                          * e.g.) log log n 
     1135                         * juxtaposition with intervening whitespace 
     1136                         * e.g.) 3 5 
    11341137                         */ 
    1135                         abstract Juxt(OpRef multiJuxt = ExprFactory.makeMultiJuxt(), 
    1136                                       OpRef infixJuxt = ExprFactory.makeInfixJuxt(), 
    1137                                       List<Expr> exprs = new LinkedList<Expr>()); 
    1138                             /** 
    1139                              * juxtaposition with intervening whitespace 
    1140                              * e.g.) 3 5 
    1141                              */ 
    1142                             LooseJuxt(); 
    1143                             /** 
    1144                              * juxtaposition without intervening whitespace. If fnApp is true, 
    1145                              * then this juxtaposition should be type checked ONLY as a function 
    1146                              * application. This should be the case for desugarings only. 
    1147                              * e.g.) f(3+5) 
    1148                              */ 
    1149                             TightJuxt(boolean fnApp = false); 
     1138                        LooseJuxt(); 
    11501139                        /** 
    1151                          * functional application 
    1152                          * Primary ::= Primary ArgExpr 
    1153                          *           | Primary Primary 
    1154                          * e.g.) x y 
     1140                         * juxtaposition without intervening whitespace. If fnApp is true, 
     1141                         * then this juxtaposition should be type checked ONLY as a function 
     1142                         * application. This should be the case for desugarings only. 
     1143                         * e.g.) f(3+5) 
    11551144                         */ 
    1156                         _RewriteFnApp(Expr function, Expr argument); 
    1157                         /** 
    1158                          * expression using operators 
    1159                          * (list of ops allows cross-API overloading) 
    1160                          * OpExpr ::= EncloserOp OpExpr? EncloserOp? 
    1161                          *          | OpExpr EncloserOp OpExpr? 
    1162                          *          | Primary 
    1163                          * EncloserOp ::= Encloser 
    1164                          *              | Op 
    1165                          * Primary ::= LeftEncloser ExprList? RightEncloser 
    1166                          *           | Primary ^ Exponent 
    1167                          *           | Primary ExponentOp 
    1168                          * e.g.) 3 + 5 
    1169                          */ 
    1170                         OpExpr(OpRef op, 
    1171                                List<Expr> args = Collections.<Expr>emptyList()); 
    1172  
    1173                         /** 
    1174                          * If an expression uses and operator, and that operator 
    1175                          * looks at parse-time like a multifix operator, it 
    1176                          * an AmbigMultifixOpExpr node is created, because it is 
    1177                          * unclear until typechecking and overloading resolution 
    1178                          * whether it should be one multifix application or several 
    1179                          * infix applications. 
    1180                          * 
    1181                          * e.g.) 3+4+5+6 
    1182                          */ 
    1183                         AmbiguousMultifixOpExpr(OpRef infix_op, OpRef multifix_op, 
    1184                                                 List<Expr> args = Collections.<Expr>emptyList()); 
    1185  
    1186                         /** 
    1187                          * chain expression 
    1188                          * Certain infix mathematical operators that are 
    1189                          * traditionally regarded as relational operators, 
    1190                          * delivering boolean results, may be chained. 
    1191                          * e.g.) A SUBSETEQ B SUBSET C SUBSETEQ D 
    1192                          */ 
    1193                         ChainExpr(Expr first, List<Link> links); 
    1194                         /** 
    1195                          * coercion invocation 
    1196                          * internal node created by static analysis 
    1197                          * after inferring the implicit coercion invocations 
    1198                          */ 
    1199                         CoercionInvocation(BaseType type, 
    1200                                            List<StaticArg> staticArgs 
    1201                                                = Collections.<StaticArg>emptyList(), 
    1202                                            Expr arg); 
    1203                         /** 
    1204                          * a method invocation 
    1205                          * some are created by parsing, while others require later 
    1206                          * static analysis to disambiguate from function applications 
    1207                          * 
    1208                          * Names of "method" must be unqualified. 
    1209                          * e.g.) myString.toUppercase() 
    1210                          */ 
    1211                         MethodInvocation(Expr obj, Id method, 
    1212                                          List<StaticArg> staticArgs 
    1213                                              = Collections.<StaticArg>emptyList(), 
    1214                                          Expr arg); 
     1145                        TightJuxt(boolean fnApp = false); 
     1146                    /** 
     1147                     * functional application 
     1148                     * Primary ::= Primary ArgExpr 
     1149                     *           | Primary Primary 
     1150                     * e.g.) x y 
     1151                     */ 
     1152                    _RewriteFnApp(Expr function, Expr argument); 
     1153                    /** 
     1154                     * expression using operators 
     1155                     * (list of ops allows cross-API overloading) 
     1156                     * OpExpr ::= EncloserOp OpExpr? EncloserOp? 
     1157                     *          | OpExpr EncloserOp OpExpr? 
     1158                     *          | Primary 
     1159                     * EncloserOp ::= Encloser 
     1160                     *              | Op 
     1161                     * Primary ::= LeftEncloser ExprList? RightEncloser 
     1162                     *           | Primary ^ Exponent 
     1163                     *           | Primary ExponentOp 
     1164                     * e.g.) 3 + 5 
     1165                     */ 
     1166                    OpExpr(OpRef op, 
     1167                           List<Expr> args = Collections.<Expr>emptyList()); 
     1168                    /** 
     1169                     * If an expression uses and operator, and that operator 
     1170                     * looks at parse-time like a multifix operator, it 
     1171                     * an AmbigMultifixOpExpr node is created, because it is 
     1172                     * unclear until typechecking and overloading resolution 
     1173                     * whether it should be one multifix application or several 
     1174                     * infix applications. 
     1175                     * 
     1176                     * e.g.) 3+4+5+6 
     1177                     */ 
     1178                    AmbiguousMultifixOpExpr(OpRef infix_op, OpRef multifix_op, 
     1179                                            List<Expr> args = Collections.<Expr>emptyList()); 
     1180                    /** 
     1181                     * chain expression 
     1182                     * Certain infix mathematical operators that are 
     1183                     * traditionally regarded as relational operators, 
     1184                     * delivering boolean results, may be chained. 
     1185                     * e.g.) A SUBSETEQ B SUBSET C SUBSETEQ D 
     1186                     */ 
     1187                    ChainExpr(Expr first, List<Link> links); 
     1188                    /** 
     1189                     * coercion invocation 
     1190                     * internal node created by static analysis 
     1191                     * after inferring the implicit coercion invocations 
     1192                     */ 
     1193                    CoercionInvocation(BaseType type, 
     1194                                       List<StaticArg> staticArgs 
     1195                                           = Collections.<StaticArg>emptyList(), 
     1196                                       Expr arg); 
     1197                    /** 
     1198                     * a method invocation 
     1199                     * some are created by parsing, while others require later 
     1200                     * static analysis to disambiguate from function applications 
     1201                     * 
     1202                     * Names of "method" must be unqualified. 
     1203                     * e.g.) myString.toUppercase() 
     1204                     */ 
     1205                    MethodInvocation(Expr obj, Id method, 
     1206                                     List<StaticArg> staticArgs 
     1207                                         = Collections.<StaticArg>emptyList(), 
     1208                                     Expr arg); 
    12151209                    /** 
    12161210                     * primary expression without any dots