Example #1
0
 def compile(cls, structure, format='js'):
     if format=='js':
         c = JsCompiler()
     else:
         c = PyCompiler()
     j20n = c.compile(structure)
     return j20n
Example #2
0
def compile(path, output=None):
    lol = get_lol(path)
    compiler = Compiler()
    js = compiler.compile(lol)
    string = Serializer.dump_program(js)
    if output == 'console':
        print(string)
        return

    if output is None:
        output = os.path.splitext(path)[0]
        output = '%s.%s' % (output, 'j20n')
    f = open(output, mode='w')
    f.write(string)
    f.close()
    return
Example #3
0
def compile(path, output=None):
    lol = get_lol(path)
    compiler = Compiler()
    js = compiler.compile(lol)
    string = Serializer.dump_program(js)
    if output == 'console':
        print(string)
        return
    
    if output is None:
        output = os.path.splitext(path)[0]
        output = '%s.%s' % (output, 'j20n')
    f = open(output, mode='w')
    f.write(string)
    f.close()
    return