Beispiel #1
0
def main():
    ivy.read_params()
    if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'):
        usage()
    with im.Module():
        isolate = ivy_compiler.isolate.get()
        ivy.source_file(sys.argv[1],
                        ivy.open_read(sys.argv[1]),
                        create_isolate=False)

        # If user specifies an isolate, check it. Else, if any isolates
        # are specificied in the file, check all, else check globally.

        if isolate != None:
            isolates = [isolate]
        else:
            isolates = sorted(list(im.module.isolates))
            if len(isolates) == 0:
                isolates = [None]

        for isolate in isolates:
            if len(im.module.isolates[isolate].verified()) == 0:
                continue  # skip if nothing to verify
            with im.module.copy():
                ivy_isolate.create_isolate(isolate, ext='ext')
                ag = ivy_art.AnalysisGraph(initializer=ivy_alpha.alpha)
                with utl.ErrorPrinter():
                    with ivy_interp.EvalContext(check=False):
                        ag.execute_action('ext')
                        cex = ag.check_bounded_safety(ag.states[-1])
                        if cex is not None:
                            display_cex("safety failed", cex)
    print "OK"
Beispiel #2
0
def main():
    with im.Module():
        ivy_init.ivy_init(create_isolate=False)
        emit(preamble)
        for sym in il.all_symbols():
            emit_symbol_def(sym)
        emit('def P := (PL.prog.letrec')
        emit_eol()
        for name, act in im.module.actions.iteritems():
            emit('  (@bndng.cons PL.pterm ("' + name + '",\n')
            emit_action(act)
            emit_eol()
            emit('    ) ')
            emit_eol()
        emit('  (bndng.default PL.pterm.skip)')
        for name, act in im.module.actions.iteritems():
            emit(')')
        emit_eol()
        exports = sorted(list(im.module.public_actions))
        if len(exports) == 0:
            emit('PL.pterm.skip')
        else:
            emit('((' + ' + '.join('(PL.pterm.call "' + x + '")'
                                   for x in exports) + ')**))')
        emit(postamble)
        basename = im.module.name
        f = open(basename + '.lean', 'w')
        f.write("".join(things))
        f.close()
def main():
    ivy_init.read_params()
    iu.set_parameters({'show_compiled':'true'})
    if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'):
        print "<bhavya> in ivy_show"
        usage()
    with im.Module():
        with utl.ErrorPrinter():
            ivy_init.source_file(sys.argv[1],ivy_init.open_read(sys.argv[1]),create_isolate=False)
            check_module()
Beispiel #4
0
def main():
    ivy_init.read_params()
    if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'):
        usage()
    with im.Module():
        with utl.ErrorPrinter():
            ivy_init.source_file(sys.argv[1],
                                 ivy_init.open_read(sys.argv[1]),
                                 create_isolate=False)
            check_module()
    print "OK"
Beispiel #5
0
def main():
    ivy.read_params()
    iu.set_parameters({'mode': 'induction'})
    if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'):
        usage()
    with im.Module():
        with utl.ErrorPrinter():
            ivy.source_file(sys.argv[1],
                            ivy.open_read(sys.argv[1]),
                            create_isolate=False)
            check_module()
    print "OK"
Beispiel #6
0
def main():
    ivy_init.read_params()
    if not sys.argv[1].endswith('ivy'):
        usage()
    for i in range(2, len(sys.argv)):
        st = sys.argv[i].split('=')
        instance[st[0]] = eval(st[1])

    with im.Module():
        with utl.ErrorPrinter():
            with iu.SourceFile(sys.argv[1]):
                decls = read_module(ivy_init.open_read(sys.argv[1]))
                translate(decls)
Beispiel #7
0
def main():
    import signal
    signal.signal(signal.SIGINT,signal.SIG_DFL)
    import ivy_alpha
    ivy_alpha.test_bottom = False # this prevents a useless SAT check
    ivy_init.read_params()
    if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'):
        usage()
    with im.Module():
        with utl.ErrorPrinter():
            ivy_init.source_file(sys.argv[1],ivy_init.open_read(sys.argv[1]),create_isolate=False)
            check_module()
    print "OK"
Beispiel #8
0
def main():
    ia.set_determinize(True)
    slv.set_use_native_enums(True)
    iso.set_interpret_all_sorts(True)
    with im.Module():
        ivy.ivy_init()

        classname = im.module.name
        with iu.ErrorPrinter():
            header, impl = module_to_cpp_class(classname)


#        print header
#        print impl
        f = open(classname + '.h', 'w')
        f.write(header)
        f.close()
        f = open(classname + '.cpp', 'w')
        f.write(impl)
        f.close()
def main():
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    with ivy_module.Module():
        ui_main_loop(ivy_init())
Beispiel #10
0
def main():
    with ivy_module.Module():
        ui_main_loop(ivy_init())
Beispiel #11
0
Datei: ivy.py Projekt: asyaf/ivy
            for x in ag.domain.relations:
                ag.domain.all_relations.append((x, ag.domain.relations[x]))
            for (x, y) in ag.domain.concepts:
                ag.domain.all_relations.append(
                    (x.atom.relname, len(x.atom.args)))
        ivy_logic.sig = ag.domain.sig  # TODO: make this an environment
        f.close()
    else:
        #        print "creating new"
        ag = ivy_new()

    if files:
        fn, f = files.pop(0)
        if not fn.endswith('.ivy') and not fn.endswith('.dfy'):
            usage()
        try:
            #            print "loading file %s" % fn
            with iu.SourceFile(fn):
                ivy_load_file(f, ag)
        except IvyError as e:
            if not hasattr(e, 'filename'):
                e.filename = fn
            print repr(e)
            sys.exit(1)
    return ag


if __name__ == "__main__":
    with ivy_module.Module():
        ui_main_loop(ivy_init())