示例#1
0
        public override Declaration VisitDeclaration(Declaration node)
        {
            if (node is Axiom)
            {
                node = this.VisitAxiom((Axiom)node);
            }
            else if (node is Variable)
            {
                node = this.VisitVariable((Variable)node);
            }
            else if (node is TypeSynonymDecl)
            {
                node = this.VisitTypeSynonymDecl((TypeSynonymDecl)node);
            }
            else if (node is TypeCtorDecl)
            {
                node = this.VisitTypeCtorDecl((TypeCtorDecl)node);
            }
            else if (node is DeclWithFormals)
            {
                node = this.VisitDeclWithFormals((DeclWithFormals)node);
            }
            else
            {
                node.Emit(new TokenTextWriter(Console.Out), 0);
                throw new InvalidInput("Unknown declaration type");
            }

            return(node);
        }
示例#2
0
 // Check that the base types are only int and bool (no user defined types)
 private static void checkBaseTypes(Declaration decl)
 {
     if (decl is TypeCtorDecl)
     {
         decl.Emit(new TokenTextWriter(Console.Out), 0);
         throw new InvalidInput("Program has a user-defined type (cannot use with ArrayTheory)");
     }
 }
示例#3
0
        public override void Emit(ILRunner pRunner)
        {
            Declaration.Emit(pRunner);

            Label start = pRunner.Emitter.DefineLabel();

            pRunner.Emitter.MarkLabel(start);
            Condition.Emit(pRunner);

            Label end = pRunner.Emitter.DefineLabel();

            pRunner.Emitter.Emit(OpCodes.Brfalse, end);

            Body.Emit(pRunner);
            PostLoop.Emit(pRunner);
            pRunner.Emitter.Emit(OpCodes.Br, start);
            pRunner.Emitter.MarkLabel(end);
        }