Changeset 4175
- Timestamp:
- Sep 13, 2014, 6:11:43 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
proto/s2k/trunk/framework/input/grammar/scatter/b2k.scatter
r4116 r4175 44 44 STRUCT, 45 45 INT, 46 //BOOL,47 //BITFIELD "BitField",48 46 BITBLOCK "BitBlock", 49 47 //CODEBLOCK, … … 81 79 interfaces { 82 80 intValued {int value = 0;}, 83 hasFieldWidth {int fieldWidth = 1;}, 81 // hasFieldWidth {int fieldWidth = 1;}, 82 intSize {int size = 1;}, 84 83 } 85 84 86 85 nodes { 87 unaryOperator {} [expr2 ],86 unaryOperator {} [expr2 indexOperatorRest], 88 87 binaryOperator {} [expr expr1 expr3 expr4], 89 88 assign {} [assignRest], 90 89 funcCall {} [funcCallRest], 91 90 idisaFuncCall {} [idisaFuncCallRest], 92 bitBlockType {hasFieldWidth;} [], 91 bitBlockType {} [], 92 bitBlockArrayType {intSize;} [bitBlockArrayTypeRest], 93 93 integerConstant {intValued;} [fieldWidthSpecifier], // codeBlockWidthSpecifier ], 94 94 // primitiveType {} [intType], // KH: update S2B 95 fieldWidthType {int fieldWidth = 1;} [],95 // fieldWidthType {int fieldWidth = 1;} [], 96 96 // codeBlockWidth{int codeBlockWidth = 128;} [], 97 97 } … … 118 118 // k e r n e l p r o p e r t i e s 119 119 // 120 kernelInitDef #->INIT LCURLY kernelProperty* RCURLY TERMINATOR? ;120 kernelInitDef -> INIT LCURLY kernelProperty* RCURLY TERMINATOR? ; 121 121 kernelProperty -> identifier ASSIGN propertyValue TERMINATOR ; 122 propertyValue -> L SQUARE integerConstant (COMMA integerConstant)* RSQUARE;122 propertyValue -> LCURLY integerConstant (COMMA integerConstant)* RCURLY ; 123 123 124 124 // … … 129 129 kernelParameter -> (kernelParameterMode COLON)? type identifier ; 130 130 kernelParameterMode -> (IN | OUT | INOUT) ; 131 kernelFuncBody # -> blockStmt ;132 carryDeclare #-> expr; // KH: temp hack to append the CarryDeclare() macro131 kernelFuncBody # -> blockStmt ; 132 carryDeclare #-> expr; // KH: temp hack to append the CarryDeclare() macro 133 133 134 134 // … … 173 173 ifStmt -> IF expr blockStmt (ELSE blockStmt)? ; 174 174 whileStmt -> WHILE expr blockStmt ; 175 176 // KH: add forStmt SA, lowerBound <= upperBound, stride != 0 177 // KH: count controlled for loop to support reductions 178 forStmt -> FOR identifier IN stridedRange blockStmt ; 179 //indexTypeDecl -> indexType identifier ; // ? 180 stridedRange -> range step ; 175 176 // KH: count controlled for loop to support reductions // Add SA, lowerBound <= upperBound, stride != 0 177 forStmt -> FOR identifier IN stridedRange blockStmt ; 178 stridedRange -> range step ; 181 179 range -> integerConstant DDOT integerConstant ; 182 180 step #-> (BY integerConstant) | epsilon {@value = 1;} ; … … 193 191 expr4 #-> expr5 ((MULTIPLY^ | DIVIDE^) expr4)? _leftAssoc_ ; 194 192 expr5 #-> ((PLUS^^ | MINUS^^)? expr6) | ((NOT^^)* expr6) ; 195 expr6 #-> compoundIdentifier ((funcCallRest _promote_) | (idisaFuncCallRest _promote_) ) ?193 expr6 #-> compoundIdentifier ((funcCallRest _promote_) | (idisaFuncCallRest _promote_) | indexOperatorRest _promote_) ? 196 194 | LROUND expr RROUND 197 195 | constant ; … … 206 204 idisaFuncCallRest -> LANGLE^ fieldWidth RANGLE LROUND idisaFuncCallArgList RROUND; // KH: parameterized function call ? 207 205 fieldWidth -> integerConstant ; // KH: fieldWidthSpecifier / expr ? 208 idisaFuncCallArgList -> (expr (COMMA expr)*) ? ; 206 idisaFuncCallArgList -> (expr (COMMA expr)*) ?; 207 indexOperatorRest -> LSQUARE expr RSQUARE ; // KH: validate integer constant expression ? 209 208 210 209 // … … 213 212 type #-> primitiveType | 214 213 bitBlockType | 215 // bitFieldType |216 214 structType | 217 215 kernelType ; … … 220 218 221 219 intType -> INT ; // { @type = {{PrimitiveType.INTEGER}}; } ; 222 bitBlockType -> BITBLOCK fieldWidthSpecifier! { @fieldWidth = @:value; 223 //@fieldWidth ; // KH ? 224 } ; 225 226 // bitFieldType -> BITFIELD fieldWidthSpecifier! 227 // { @fieldWidth = @:value; 228 // // @type = {{ new BitFieldType(%?) }} , @fieldWidth ; 229 // } ; 220 bitBlockType -> BITBLOCK ; //fieldWidthSpecifier! { @fieldWidth = @:value; 221 // //@fieldWidth ; // KH ? 222 // } ; 223 224 bitBlockArrayTypeRest -> LSQUARE expr RSQUARE ; // KH: validate integer constant expression 230 225 231 226 fieldWidthSpecifier #-> (LANGLE integerConstant RANGLE )
Note: See TracChangeset
for help on using the changeset viewer.