当前位置: 首页>>代码示例>>C#>>正文


C# Microcode.Symbol类代码示例

本文整理汇总了C#中Microcode.Symbol的典型用法代码示例。如果您正苦于以下问题:C# Symbol类的具体用法?C# Symbol怎么用?C# Symbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Symbol类属于Microcode命名空间,在下文中一共展示了Symbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StaticMapping

        public StaticMapping (Symbol [] names, int [] offsets)
        {
            int [] mapping = offsets;
            
#if DEBUG
            bool found = false;
            foreach (int [] knownMapping in knownMappings) {
               if (SameMapping(knownMapping, offsets)) {
                   mapping = knownMapping;
                   found = true;
                   break;
               }
            }
            if (!found)
                knownMappings.Add(mapping);
#endif
            this.names = names;
            this.offsets = mapping;
            foreach (int offset in offsets)
            {
                if (offset > 30)
                {
                    this.offsetCode = -1;
                    break;
                }
                this.offsetCode += 1 << offset;
            }
        }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:28,代码来源:StaticMapping.cs

示例2: LambdaBase

        protected LambdaBase(Symbol name, Symbol [] formals, SCode body, ICollection<Symbol> freeVariables, StaticMapping staticMapping)
        {
            this.lambdaName = name;
            this.lambdaFormals = formals;
            this.lambdaBody = body;
            this.lambdaFreeVariables = freeVariables;
            this.staticMapping = staticMapping;
            #if DEBUG
            // Paranoia:  check for duplicate maps
            if (name != Dummy)
                for (int i = 0; i < formals.Length - 1; i++)
                    if (formals [i] != null)
                        for (int j = i + 1; j < formals.Length; j++)
                            if (formals [i] == formals [j])
                                Debugger.Break ();

            // //Check for eta-reducible primitive lambdas.  There seem to be
            // //too many of these.
            // Bug found and fixed.
            //if (body is PrimitiveCombination0 &&
            //    formals.Length == 0 )
            //    Debugger.Break ();

            //if (body is PrimitiveCombination1 &&
            //    formals.Length == 1 &&
            //    ((PrimitiveCombination1) body).Operand is Variable &&
            //    ((Variable) ((PrimitiveCombination1) body).Operand).Name == formals [0])
            //    Debugger.Break ();

            //if (body is PrimitiveCombination2 &&
            //    formals.Length == 2 &&
            //    ((PrimitiveCombination2) body).Operand0 is Variable &&
            //    ((PrimitiveCombination2) body).Operand1 is Variable &&
            //    ((Variable) ((PrimitiveCombination2) body).Operand0).Name == formals [0] &&
            //    ((Variable) ((PrimitiveCombination2) body).Operand1).Name == formals [1]) {
            //    Debugger.Break ();
            //}

            //if (body is PrimitiveCombination3 &&
            //    formals.Length == 3 &&
            //    ((PrimitiveCombination3) body).Operand0 is Variable &&
            //    ((PrimitiveCombination3) body).Operand1 is Variable &&
            //    ((PrimitiveCombination3) body).Operand2 is Variable &&
            //    ((Variable) ((PrimitiveCombination3) body).Operand0).Name == formals [0] &&
            //    ((Variable) ((PrimitiveCombination3) body).Operand1).Name == formals [1] &&
            //    ((Variable) ((PrimitiveCombination3) body).Operand2).Name == formals [2])
            //    Debugger.Break ();
            #endif
        }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:49,代码来源:Lambda.cs

示例3: ReadFormals

        public void ReadFormals(uint location, out Symbol name, out Symbol [] formals)
        {
            object [] names = (object []) ReadObject (location);
            for (int i = 0; i < names.Length - 1; i++)
                for (int j = i + 1; j < names.Length; j++)
                    if (names [i] == names [j])
                        Debugger.Break ();

            name = (Symbol) names [0];
            formals = new Symbol [names.Length-1];
            for (int i = 1; i < names.Length; i++)
                formals [i - 1] = (names [i] is Symbol) ? (Symbol) names [i] : Symbol.MakeUninterned ((string) names [i]);
            return;
        }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:14,代码来源:Fasl.cs

示例4: LookupVariableUncached

        internal override SCode LookupVariableUncached(Symbol variable,
            Func<int, int, SCode> ifLexicalVariable,
            Func<int, int, SCode> ifShadowableLexicalVariable,
            Func<StandardEnvironment, SCode> ifAuxVariable,
            Func<StandardEnvironment, SCode> ifShadowableAuxVariable,
            Func<StandardEnvironment, SCode> ifFreeVariable,
            Func<StandardEnvironment, SCode> ifShadowableFreeVariable,
            Func<GlobalEnvironment, ValueCell, SCode> ifGlobalVariable,
            Func<GlobalEnvironment, ValueCell, SCode> ifShadowableGlobalVariable)
        {
            throw new NotImplementedException ();
            //    this.environment.LocateVariable<SCode> (variable,
            //        delegate () { throw new NotImplementedException (); },
            //        delegate (ValueCell cell) { throw new NotImplementedException (); },
            //        delegate (LexicalEnvironment env, int depth, int o) {
            //            if (depth == 0) {
            //                return ifLexicalVariable (depth, o);
            //            }
            //            else {
            //                return ifShadowableLexicalVariable (depth, o);
            //            }
            //        },
            //        delegate (StandardEnvironment env, int depth) {
            //            if (depth == 0) {
            //                return ifAuxVariable (env);
            //            }
            //            else {
            //                return ifShadowableAuxVariable (env);
            //            }
            //        });

            //    int offset = this.environment.SearchFormals (variable);
            //    if (offset == -1) {
            //        ValueCell cell = this.environment.SearchIncrementals(variable);
            //        if (cell == null)
            //            return ifFreeVariable (this.environment);
            //        return ifAuxVariable (this.environment);
            //    }
            //    return ifLexicalVariable (0, offset);
        }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:40,代码来源:LexicalMap.cs

示例5: UnboundVariableError

 public UnboundVariableError(Symbol name)
     : base(1)
 {
     this.name = name;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:5,代码来源:Error.cs

示例6: LookupVariable

 internal SCode LookupVariable(Symbol variable,
     Func<int, int, SCode> ifLexicalVariable,
     Func<int, int, SCode> ifShadowableLexicalVariable,
     Func<StandardEnvironment, SCode> ifAuxVariable,
     Func<StandardEnvironment, SCode> ifShadowableAuxVariable,
     Func<StandardEnvironment, SCode> ifFreeVariable,
     Func<StandardEnvironment, SCode> ifShadowableFreeVariable,
     Func<GlobalEnvironment, ValueCell, SCode> ifGlobalVariable,
     Func<GlobalEnvironment, ValueCell, SCode> ifShadowableGlobalVariable)
 {
     SCode answer;
     if (this.cache.TryGetValue (variable, out answer))
         return answer;
     answer = LookupVariableUncached (variable,
         ifLexicalVariable,
         ifShadowableLexicalVariable,
         ifAuxVariable,
         ifShadowableAuxVariable,
         ifFreeVariable,
         ifShadowableFreeVariable,
         ifGlobalVariable,
         ifShadowableGlobalVariable);
     cache.Add (variable, answer);
     return answer;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:25,代码来源:LexicalMap.cs

示例7: PCondIsNullA0XS

 protected PCondIsNullA0XS(PrimitiveIsNullA0 predicate, SCode consequent, StaticVariable alternative)
     : base(predicate, consequent, alternative)
 {
     this.alternativeName = alternative.Name;
     this.alternativeOffset = alternative.Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PCondIsNull.cs

示例8: PrimitiveStringSetS

 protected PrimitiveStringSetS(StaticVariable arg0, SCode arg1, SCode arg2)
     : base(arg0, arg1, arg2)
 {
     this.rand0Name = arg0.Name;
     this.rand0Offset = arg0.Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PrimitiveStringSet.cs

示例9: PrimitiveGreaterThanFixnumS

 protected PrimitiveGreaterThanFixnumS(Primitive2 rator, StaticVariable rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
     this.rand0Name = rand0.Name;
     this.rand0Offset = rand0.Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PrimitiveGreaterThanFixnum.cs

示例10: PCondLessThanFixnumS

 protected PCondLessThanFixnumS(PrimitiveLessThanFixnumS predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.rand0Name = predicate.rand0Name;
     this.rand0Offset = predicate.rand0Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PCondLessThanFixnum.cs

示例11: PrimitiveIsEqSS

 internal PrimitiveIsEqSS(Primitive2 rator, StaticVariable rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     #if DEBUG
     if (rand0.Offset == rand1.Offset) Debugger.Break ();
     #endif
     this.rand1Name = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:9,代码来源:PrimitiveIsEq.cs

示例12: PrimitiveIsEqS

 protected PrimitiveIsEqS(Primitive2 rator, StaticVariable rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
     this.rand0Name = rand0.Name;
     this.rand0Offset = rand0.Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PrimitiveIsEq.cs

示例13: PrimitiveIsEqCarXS

 protected PrimitiveIsEqCarXS(Primitive2 rator, PrimitiveCar rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PrimitiveIsEq.cs

示例14: PrimitiveIsEqCarS

 protected PrimitiveIsEqCarS(Primitive2 rator, PrimitiveCarS rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
     this.rand0ArgOffset = rand0.offset;
     this.rand0ArgName = rand0.name;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PrimitiveIsEq.cs

示例15: PrimitiveIsEqCarAS

 internal PrimitiveIsEqCarAS(Primitive2 rator, PrimitiveCarA rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:6,代码来源:PrimitiveIsEq.cs


注:本文中的Microcode.Symbol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。