Example #1
0
 // private constructor
 // ===================
 // 
 private Scope(List<Utils.StoreEntry> stack_entries,
               Int32 stack_offset,
               List<Utils.StoreEntry> global_entries,
               FunctionType curr_func,
               List<Utils.StoreEntry> typedef_entries,
               List<Utils.StoreEntry> enum_entries) {
     this.locals = stack_entries;
     this.esp_pos = stack_offset;
     this.globals = global_entries;
     this.func = curr_func;
     this.typedefs = typedef_entries;
     this.enums = enum_entries;
 }
Example #2
0
 public Env2 InFunction(FunctionType functionType, ImmutableList<ParameterObjectEntry> functionParams) {
     if (this._functionScope.IsSome) {
         throw new InvalidProgramException("Is already in a function. Cannot go in function.");
     }
     return new Env2(
         this._globalSymbolTable,
         Option.Some(new FunctionScope(functionType, functionParams))
     );
 }
Example #3
0
 public FunctionScope(FunctionType functionType, ImmutableList<ParameterObjectEntry> functionParams)
     : this(functionType, functionParams, ImmutableStack<LocalSymbolTable>.Empty) { }
Example #4
0
 // SetCurrentFunction
 // ==================
 // input: Type
 // ouput: Environment
 // return a new environment which sets the current function
 // 
 public Env SetCurrentFunction(FunctionType type) {
     Scope top = this._scopes.Peek();
     return new Env(this._scopes.Pop().Push(top.SetCurrentFunction(type)));
 }
Example #5
0
 public FunctionScope(FunctionType functionType, ImmutableList<ParameterObjectEntry> functionParams, ImmutableStack<LocalSymbolTable> localScopes) {
     this.FunctionType = functionType;
     this.FunctionParams = FunctionParams;
     this.LocalScopes = localScopes;
 }
Example #6
0
 public FuncCall(Expr func, FunctionType funcType, List<Expr> args) {
     this.Func = func;
     this.FuncType = funcType;
     this.Args = args;
 }
Example #7
0
 // SetCurrFunc
 // ===========
 // set the current function
 public Scope SetCurrentFunction(FunctionType type) {
     return new Scope(this.locals, this.esp_pos, this.globals,
         type, this.typedefs, this.enums
     );
 }
 public FuncDef(String name, StorageClass scs, FunctionType type, Stmt stmt) {
     this.name = name;
     this.scs  = scs;
     this.type = type;
     this.stmt = stmt;
 }
Example #9
0
 public FunctionScope(FunctionType functionType, ImmutableList <ParameterObjectEntry> functionParams)
     : this(functionType, functionParams, ImmutableStack <LocalSymbolTable> .Empty)
 {
 }
Example #10
0
 public FunctionScope(FunctionType functionType, ImmutableList <ParameterObjectEntry> functionParams, ImmutableStack <LocalSymbolTable> localScopes)
 {
     this.FunctionType   = functionType;
     this.FunctionParams = FunctionParams;
     this.LocalScopes    = localScopes;
 }
Example #11
0
        // SetCurrentFunction
        // ==================
        // input: Type
        // ouput: Environment
        // return a new environment which sets the current function
        //
        public Env SetCurrentFunction(FunctionType type)
        {
            Scope top = this._scopes.Peek();

            return(new Env(this._scopes.Pop().Push(top.SetCurrentFunction(type))));
        }
Example #12
0
 // SetCurrFunc
 // ===========
 // set the current function
 public Scope SetCurrentFunction(FunctionType type)
 {
     return(new Scope(this.locals, this.esp_pos, this.globals,
                      type, this.typedefs, this.enums
                      ));
 }