2018-05-20 00:57:30 +08:00
|
|
|
import sys, os, fileinput
|
2015-07-14 11:44:16 +08:00
|
|
|
from pythonparser import diagnostic
|
2018-05-20 00:57:30 +08:00
|
|
|
from .. import ir
|
2015-11-26 10:23:59 +08:00
|
|
|
from ..module import Module, Source
|
2015-07-14 11:44:16 +08:00
|
|
|
|
|
|
|
def main():
|
2018-05-20 00:57:30 +08:00
|
|
|
if os.getenv("ARTIQ_IR_NO_LOC") is not None:
|
|
|
|
ir.BasicBlock._dump_loc = False
|
|
|
|
|
2015-07-14 11:44:16 +08:00
|
|
|
def process_diagnostic(diag):
|
|
|
|
print("\n".join(diag.render()))
|
|
|
|
if diag.level in ("fatal", "error"):
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
engine = diagnostic.Engine()
|
|
|
|
engine.process = process_diagnostic
|
|
|
|
|
2015-08-06 13:24:41 +08:00
|
|
|
mod = Module(Source.from_string("".join(fileinput.input()).expandtabs(), engine=engine))
|
2015-07-21 09:54:34 +08:00
|
|
|
for fn in mod.artiq_ir:
|
2015-07-14 11:44:16 +08:00
|
|
|
print(fn)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|