These are chat archives for evhub/coconut

Jul 2017
Evan Hubinger
Jul 16 2017 19:57

@croqaz Take a look at Coconut Modules, specifically coconut.convenience.parse, which should let you compile Coconut programmatically. For example, you should be able to do something like

from coconut.convenience import parse
exec(parse("", mode="sys"))  # setup Coconut execution environment
while True:
    exec(parse(input(), mode="block"))

which should do what you want! As for restricting features, that's a little bit harder. The best way might be to parse an ast of the compiled python (the result of parse) and raise an error on encountering any features you don't want at that point.