Changeset 3363


Ignore:
Timestamp:
Jun 26, 2013, 3:21:01 PM (6 years ago)
Author:
ksherdy
Message:

svn blues, partial commits.

Location:
proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS
Files:
3 added
8 copied

Legend:

Unmodified
Added
Removed
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/AssignStreamInitialValues.java

    r3330 r3363  
    1111 */
    1212
    13 package toolchain.pabloS.transformer.visitors;
     13package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    1414
    1515import pabloS.ast.*;
     
    1717import toolchain.pabloS.ast.Generators;
    1818
    19 public class InitializeStreamDefaults {
    20         private InitializeStreamDefaults() {}
     19public class AssignStreamInitialValues {
     20        private AssignStreamInitialValues() {}
    2121       
    2222        static public ASTNode apply(ASTNode root) {
     
    5151               
    5252                public void visitLeave(StructMemberNode node) {
    53                         // TODO - Add logic for filed initialization.
     53                        // TODO - KH: Add logic for struct member initialization.
    5454                }
    5555               
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/CombineScopes.java

    r3345 r3363  
    66 * (3) Moves block-level variable declarations to the function-level scope.
    77 *     
     8 * TODO - KH: Move to PabloB2PabloB on implementation of PabloB SemanticAnalysis
     9 *
    810 * @author Ken Herdy <ksherdy at sfu dot ca>
    911 */
    1012
    11 package toolchain.pabloS.transformer.visitors;
     13package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    1214
    1315import static toolchain.util.MapUtil.addValueToList;
     
    1921import pabloS.inputHandler.Locator;
    2022import pabloS.logging.ScatterLogger;
    21 import toolchain.pabloS.ast.Accessors;
    22 import toolchain.pabloS.ast.Generators;
    23 import toolchain.pabloS.ast.Mutators;
    24 import toolchain.pabloS.lang.type.StreamType;
    25 import toolchain.pabloS.lang.type.Type;
    26 import toolchain.pabloS.semanticAnalyzer.Binding;
    27 import toolchain.pabloS.semanticAnalyzer.SymbolTable;
     23import toolchain.pabloS.ast.*;
     24import toolchain.pabloS.lang.type.*;
     25import toolchain.pabloS.semanticAnalyzer.*;
    2826import toolchain.util.Labeller;
    2927
     
    7169            SymbolTable symbolTable = findEnclosingSymbolTable(node);
    7270           
    73             String varName = Accessors.varDeclName(node);
     71            String varName = Accessors.name(node);
    7472           
    7573            if(symbolTable.hasBinding(varName)) {
     
    135133            } else if (node.getParent() instanceof FuncCallNode) {
    136134                // no action
    137             } else if (Accessors.name(node).startsWith("carry_set")) {
    138                 // no action
    139             } else if (Accessors.name(node).equals("EOF_mask")) {
     135            } else if (Accessors.name(node).startsWith("carry_set")) {  // TODO - KH: remove on move of Semantic Analysis to PabloB
     136                // no action
     137            } else if (Accessors.name(node).equals("EOF_mask")) {       // TODO - KH: remove on move of Semantic Analysis to PabloB
    140138                // no action
    141139            } else {
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/ExpandAugmentedAssignments.java

    r3293 r3363  
    55 */
    66
    7 package toolchain.pabloS.transformer.visitors;
     7package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    88
    99import java.util.HashMap;
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/PabloS2SPabloController.java

    r3350 r3363  
    55 */
    66
    7 package toolchain.pabloS.transformer;
     7package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    88
    99
    10 import toolchain.pabloS.lang.*;
    11 import toolchain.pabloS.lang.carrySet.CarrySetEncoder;
    12 import toolchain.pabloS.semanticAnalyzer.SemanticAnalyzer;
    13 import toolchain.pabloS.transformer.visitors.*;
    14 import toolchain.pabloS.transformer.visitors.carry.*;
    15 
    16 public class Transformer {
    17        
    18         private pabloS.ast.ASTNode ASTTree;
    19        
    20         //private SymbolTable symbolTable;
    21        
    22         private PabloSBuiltinEncoder builtinEncoder;
    23         private CarrySetEncoder carrySet2Lang;
    24         private boolean finalBlockMode;
     10public class PabloS2SPabloController {
    2511       
    2612        //////////////////////////////////////////////////////////////
    27         // static interface - transforms AST in default mode only
    28         //
    29         public static pabloS.ast.ASTNode analyze(pabloS.ast.ASTNode root) {
    30                 Transformer analyzer = new Transformer(root);           
    31                 return analyzer.xForm();
     13        // static interface
     14        public static pabloS.ast.ASTNode accept(pabloS.ast.ASTNode ASTree) {
     15        pabloS.ast.ASTNode decoratedTree = ASTree.deepCopy();
     16        decoratedTree = ExpandAugmentedAssignments.apply(decoratedTree);
     17        decoratedTree = CombineAdvances.apply(decoratedTree);
     18        return decoratedTree;
    3219        }       
    33        
    34         //////////////////////////////////////////////////////////////
    35         // constructor and helpers
    36         public Transformer(pabloS.ast.ASTNode ASTTree) {
    37                
    38                 this.ASTTree = ASTTree;         
    39                 initDefaults();
    40         }       
    41        
    42         private void initDefaults() {
    43                 this.setBuiltins2Lang(new PabloSBuiltin2CPP());
    44                 this.setCarrySet2Lang(new toolchain.pabloS.lang.carrySet.CarrySetBuiltin2CPP());
    45                 this.setFinalBlockMode(false);
    46         }
    47        
    48         //////////////////////////////////////////////////////////////
    49         // analysis
    50         public pabloS.ast.ASTNode xForm() {
    51                
    52             pabloS.ast.ASTNode decoratedTree = ASTTree.deepCopy();
    53            
    5420
    55            
    56                 decoratedTree = ExpandAugmentedAssignments.apply(decoratedTree);
    57                 decoratedTree = SurroundAssert0sWithIfs.apply(decoratedTree, getBuiltinEncoder());             
    58                 decoratedTree = CombineAdvances.apply(decoratedTree);
    59                
    60              
    61                
    62                 decoratedTree = CarryIntroXFormer.apply(decoratedTree, getBuiltinEncoder(), getCarrySet2Lang(), finalBlockMode);
    63                 decoratedTree = CarryIntroXFormer.apply(decoratedTree, getBuiltinEncoder(), getCarrySet2Lang(), finalBlockMode);
    64                
    65                 decoratedTree = SurroundConditionsWithBitBlockAny.apply(decoratedTree);
    66                 decoratedTree = ConvertBitwiseBooleanToIDISACalls.apply(decoratedTree);
    67                 //decoratedTree = InitializeStreamDefaults.apply(decoratedTree);
    68                
    69         //decoratedTree = CombineScopes.apply(decoratedTree);
    70                                
    71                 return decoratedTree;
    72                
    73         }
    74 
    75         public PabloSBuiltinEncoder getBuiltinEncoder() {
    76                 return this.builtinEncoder;
    77         }
    78 
    79         public void setBuiltins2Lang(PabloSBuiltinEncoder builtins2Lang) {
    80                 this.builtinEncoder = builtins2Lang;
    81         }
    82 
    83         public CarrySetEncoder getCarrySet2Lang() {
    84                 return carrySet2Lang;
    85         }
    86 
    87         public void setCarrySet2Lang(toolchain.pabloS.lang.carrySet.CarrySetEncoder carrySet2Lang) {
    88                 this.carrySet2Lang = carrySet2Lang;
    89         }
    90 
    91         public boolean isFinalBlockMode() {
    92                 return finalBlockMode;
    93         }
    94 
    95         public void setFinalBlockMode(boolean finalBlockMode) {
    96                 this.finalBlockMode = finalBlockMode;
    97         }
    98        
    9921}               
    10022
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/SomeNameStreamFunctionPropertySet.java

    r3293 r3363  
    44 * @author Ken Herdy <ksherdy at sfu dot ca>
    55 */
    6 package toolchain.pabloS.transformer.visitors;
     6package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    77
    88import java.util.ArrayList;
    99
    10 public class StreamFunctionPropertySet {
     10public class SomeNameStreamFunctionPropertySet {
    1111
    12         private ArrayList<Integer> carry1;
     12    private ArrayList<Integer> carry1;
    1313        private ArrayList<Integer> carryN;
    1414        private int lookAhead;
    1515        private int lookBehind;
    1616       
    17         public StreamFunctionPropertySet () {
     17        public SomeNameStreamFunctionPropertySet () {
    1818                carry1        = new ArrayList<Integer>();
    1919                carryN        = new ArrayList<Integer>();
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/SomeNameStreamFunctionPropertySetFactory.java

    r3347 r3363  
    44 * @author Ken Herdy <ksherdy at sfu dot ca>
    55 */
    6 package toolchain.pabloS.transformer.visitors;
     6package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    77
    88import pabloS.ast.*;
    99import toolchain.pabloS.lang.BuiltinCallUtil;
    1010
    11 public class StreamFunctionPropertySetFactory {
     11public class SomeNameStreamFunctionPropertySetFactory {
    1212       
    13     static public StreamFunctionPropertySet apply(FuncDefNode node) {
     13    static public SomeNameStreamFunctionPropertySet apply(FuncDefNode node) {
    1414        StreamFunctionPropertySetVisitor visitor = new StreamFunctionPropertySetVisitor();
    1515        node.accept(visitor);
     
    1919    static private class StreamFunctionPropertySetVisitor extends VoidVisitor.Default {
    2020       
    21         private StreamFunctionPropertySet propertySet = new StreamFunctionPropertySet();
     21        private SomeNameStreamFunctionPropertySet propertySet = new SomeNameStreamFunctionPropertySet();
    2222       
    23         public StreamFunctionPropertySet propertySet() {
     23        public SomeNameStreamFunctionPropertySet propertySet() {
    2424            return propertySet;
    2525        }
     
    3636                        propertySet.addNextCarryNInitValue(0);
    3737                }
    38                
    39                 // KH: TODO - add logic for additional properties such as lookahead, lookbehind, ...
     38                 
    4039        }
    4140    }
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/StreamFunctionDefs.java

    r3293 r3363  
    55 */
    66
    7 package toolchain.pabloS.transformer.visitors;
     7package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    88
    99import java.util.*;
    1010import pabloS.ast.*;
    1111
    12 public class StreamFunctions extends ArrayList<FuncDefNode> {
     12public class StreamFunctionDefs extends ArrayList<FuncDefNode> {
    1313       
    1414        private static final long serialVersionUID = 8639586378925373084L;
    1515
    16         public static ArrayList<FuncDefNode> makeList(ASTNode ASTTree) {
     16        public static ArrayList<FuncDefNode> forTree(ASTNode ASTTree) {
    1717            Visitor visitor = new Visitor();
    1818                ASTTree.accept(visitor);
  • proto/pabloj/trunk/src/toolchain/pabloS/transformer/visitors/pabloS2pabloS/SurroundAssert0sWithIfs.java

    r3347 r3363  
    77 */
    88
    9 package toolchain.pabloS.transformer.visitors;
     9package toolchain.pabloS.transformer.visitors.pabloS2pabloS;
    1010
    1111import pabloS.ast.*;
     
    2424// }
    2525//
    26 // also, what is the encoded assert0 ?  If the if(errorStream) is done, then
    27 // is it simply an "issue error" call?
    28 //
    2926public class SurroundAssert0sWithIfs {
    3027        static public ASTNode apply(ASTNode ASTree, PabloSBuiltinEncoder encoder) {
     
    3936                        this.encoder = encoder;
    4037                }
    41 
    4238                               
    4339                public void visitEnter(FuncCallNode node) {
Note: See TracChangeset for help on using the changeset viewer.