2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-28 20:53:35 +08:00

Replace builtin ast with pythonparser.ast.

This commit is contained in:
whitequark 2015-05-27 17:04:18 +03:00
parent f30d671359
commit c75fd6bc88
5 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import ast
from pythonparser import ast
import llvmlite.ir as ll

View File

@ -1,5 +1,5 @@
import inspect
import ast
from pythonparser import parse, ast
import llvmlite.ir as ll
@ -18,7 +18,7 @@ def _gcd(a, b):
def init_module(module):
func_def = ast.parse(inspect.getsource(_gcd)).body[0]
func_def = parse(inspect.getsource(_gcd)).body[0]
function, _ = module.compile_function(func_def,
{"a": VInt(64), "b": VInt(64)})
function.linkage = "internal"

View File

@ -1,11 +1,12 @@
import ast
import pythonparser.algorithm
from pythonparser import ast
from copy import deepcopy
from artiq.py2llvm.ast_body import Visitor
from artiq.py2llvm import base_types
class _TypeScanner(ast.NodeVisitor):
class _TypeScanner(pythonparser.algorithm.Visitor):
def __init__(self, env, ns):
self.exprv = Visitor(env, ns)

View File

@ -1,5 +1,5 @@
import unittest
import ast
from pythonparser import parse, ast
import inspect
from fractions import Fraction
from ctypes import CFUNCTYPE, c_int, c_int32, c_int64, c_double
@ -43,7 +43,7 @@ def _base_types(choice):
def _build_function_types(f):
return infer_function_types(
None, ast.parse(inspect.getsource(f)),
None, parse(inspect.getsource(f)),
dict())
@ -111,7 +111,7 @@ class CompiledFunction:
def __init__(self, function, param_types):
module = Module()
func_def = ast.parse(inspect.getsource(function)).body[0]
func_def = parse(inspect.getsource(function)).body[0]
function, retval = module.compile_function(func_def, param_types)
argvals = [param_types[arg.arg] for arg in func_def.args.args]

View File

@ -6,7 +6,7 @@ from setuptools import setup, find_packages
requirements = [
"sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy",
"python-dateutil", "prettytable", "h5py", "pydaqmx", "pyelftools",
"quamash", "pyqtgraph"
"quamash", "pyqtgraph", "pythonparser"
]
scripts = [