https://github.com/EasyCrypt/easycrypt
Raw File
Tip revision: a2dcec97cf776a2dc0c66353b7963b8a02beeab0 authored by Benjamin Gregoire on 17 October 2022, 07:44:02 UTC
add missing restriction in the case of adversary
Tip revision: a2dcec9
dune-lib
#! /usr/bin/env python3

# --------------------------------------------------------------------
import sys, os

# --------------------------------------------------------------------
def _main():
    if len(sys.argv)-1 != 1:
        print(f'Usage: {sys.argv[0]} [theory directory]')
        exit(1)

    thdir  = sys.argv[1]

    theories = []
    for root, _, files in os.walk(thdir):
        for fname in files:
            if os.path.splitext(fname)[1] in ('.ec', '.eca'):
                theories.append(os.path.relpath(os.path.join(root, fname), thdir))
    theories = sorted(theories)
    namemax  = max(0, *(len(x) for x in theories))

    print('(install')
    print('  (section (site (easycrypt theories)))')
    print('  (files')
    for theory in theories:
        print(f'      ({theory:{namemax}} as {theory})')
    print('  )')
    print(')')

# --------------------------------------------------------------------
if __name__ == '__main__':
    _main()

back to top