Changeset 3403


Ignore:
Timestamp:
Feb 12, 2008, 2:13:58 PM (13 years ago)
Author:
yura
Message:
 
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.plus.rfpdt/src/org/refal/plus/rfpdt/core/builder/RefalASGenerator.java

    r3402 r3403  
    22
    33import org.refal.plus.Expr;
    4 import org.refal.plus.Symbol;
    54import org.refal.plus.Expr.Concatenator;
    65import org.refal.plus.rfpdt.comp.ast.AstAlt;
     
    4342public class RefalASGenerator implements ProgramVisitorWithEnv<Expr.Concatenator>,
    4443        SentenceVisitorWithEnv<Expr.Concatenator>, ExpVisitorWithEnv<Expr.Concatenator> {
    45     private static final Comparable<String> MODULE = Symbol.newWord("MODULE");
    46     private static final Comparable<String> IMPORT = Symbol.newWord("IMPORT");
    47     private static final Comparable<String> EXPORT = Symbol.newWord("EXPORT");
    48     private static final Comparable<String> LOCAL = Symbol.newWord("LOCAL");
    49     private static final Comparable<String> FUNC = Symbol.newWord("FUNC");
    50     private static final Comparable<String> FUNC_Q = Symbol.newWord("FUNC?");
    51     private static final Comparable<String> CONST = Symbol.newWord("CONST");
    52     private static final Comparable<String> NATIVE = Symbol.newWord("NATIVE");
    53     private static final Comparable<String> BRANCH = Symbol.newWord("BRANCH");
    54     private static final Comparable<String> ALT = Symbol.newWord("ALT");
    55     private static final Comparable<String> ALT_Q = Symbol.newWord("ALT?");
    56     private static final Comparable<String> NOT = Symbol.newWord("NOT");
    57     private static final Comparable<String> ITER = Symbol.newWord("ITER");
    58     private static final Comparable<String> TRY = Symbol.newWord("TRY");
    59     private static final Comparable<String> FORMAT = Symbol.newWord("FORMAT");
    60     private static final Comparable<String> LEFT = Symbol.newWord("LEFT");
    61     private static final Comparable<String> RIGHT = Symbol.newWord("RIGHT");
    62     private static final Comparable<String> RESULT = Symbol.newWord("RESULT");
    63     private static final Comparable<String> PAREN = Symbol.newWord("PAREN");
    64     private static final Comparable<String> CALL = Symbol.newWord("CALL");
    65     private static final Comparable<String> REF = Symbol.newWord("REF");
    66     private static final Comparable<String> CUT = Symbol.newWord("CUT");
    67     private static final Comparable<String> FENCE = Symbol.newWord("STAKE");
    68     private static final Comparable<String> CUTALL = Symbol.newWord("CUTALL");
    69     private static final Comparable<String> FAIL = Symbol.newWord("FAIL");
    70     private static final Comparable<String> ERROR = Symbol.newWord("ERROR");
     44    private static final String MODULE = "MODULE";
     45    private static final String IMPORT = "IMPORT";
     46    private static final String EXPORT = "EXPORT";
     47    private static final String LOCAL = "LOCAL";
     48    private static final String FUNC = "FUNC";
     49    private static final String FUNC_Q = "FUNC?";
     50    private static final String CONST = "CONST";
     51    private static final String NATIVE = "NATIVE";
     52    private static final String BRANCH = "BRANCH";
     53    private static final String ALT = "ALT";
     54    private static final String ALT_Q = "ALT?";
     55    private static final String NOT = "NOT";
     56    private static final String ITER = "ITER";
     57    private static final String TRY = "TRY";
     58    private static final String FORMAT = "FORMAT";
     59    private static final String LEFT = "LEFT";
     60    private static final String RIGHT = "RIGHT";
     61    private static final String RESULT = "RESULT";
     62    private static final String PAREN = "PAREN";
     63    private static final String CALL = "CALL";
     64    private static final String REF = "REF";
     65    private static final String CUT = "CUT";
     66    private static final String FENCE = "STAKE";
     67    private static final String CUTALL = "CUTALL";
     68    private static final String FAIL = "FAIL";
     69    private static final String ERROR = "ERROR";
    7170
    7271    private static Expr makeName (String name) {
     
    177176        else
    178177            items.toRight(LOCAL);
    179         items.toRight(Symbol.newWord(astObjDecl.kind.toString().toUpperCase()));
     178        items.toRight(astObjDecl.kind.name().toUpperCase()); // FIXME
    180179        String modName = astObjDecl.module != null ? astObjDecl.module : moduleName;
    181180        items.toRight(makeName(modName + "." + astObjDecl.name.identifier));
     
    332331
    333332    public void visit (AstVar astVar, Expr.Concatenator e) {
    334         Comparable<String> symbol1 = Symbol.newWord(astVar.type.name() + "VAR");
    335         Comparable<Expr> symbol2;
     333        String varType = astVar.type.name().toUpperCase() + "VAR"; // FIXME
     334        Comparable<Expr> varName;
    336335        if (astVar.name != null && astVar.name.identifier.length() > 0)
    337             symbol2 = new Expr(Symbol.newWord(astVar.name.identifier));
     336            varName = new Expr(astVar.name.identifier); // FIXME
    338337        else
    339             symbol2 = new Expr(Symbol.newWord("$tmp-" + astVar.pos.charStart));
    340         e.toRight((Comparable<Expr>) Expr.concat(symbol1, symbol2));
     338            varName = new Expr("$tmp-" + astVar.pos.charStart); // FIXME
     339        e.toRight((Comparable<Expr>) Expr.concat(varType, varName));
    341340    }
    342341
    343342    public void visit (AstWordSymbol astWordSymbol, Expr.Concatenator e) {
    344         e.toRight(Symbol.newWord(astWordSymbol.word));
     343        e.toRight(astWordSymbol.word); // FIXME
    345344    }
    346345}
  • to-imperative/trunk/java/runtime/org/refal/plus/Symbol.java

    r3401 r3403  
    1717    private Symbol () {}
    1818
    19     public static final Comparable<Reference> null_object = new Reference(null);
     19    public static final Comparable null_object = new Reference(null);
    2020
    21     public static Comparable<BigInteger> newInt (String str) {
     21    public static Comparable newInt (String str) {
    2222        return new BigInteger(str);
    2323    }
    2424
    25     public static Comparable<String> newWord (String str) {
     25    public static Comparable newWord (String str) {
    2626        return str;
    2727    }
Note: See TracChangeset for help on using the changeset viewer.