def compile(pathnames, out, err=sys.stderr, externals=None): from spike.compiler.scheck import check, declareBuiltIn, declareExternalSymbols from spike.compiler.symbols import SymbolTable from spike.compiler.cgen import generateCode from spike.compiler.statements import Compound, PragmaSource notifier = Notifier(stream=err) st = SymbolTable() declareBuiltIn(st, notifier) if externals: declareExternalSymbols(externals, st, notifier) tree = Compound() for pathname in pathnames: t = parse(pathname, notifier) if t is None: continue tree.append(PragmaSource(pathname)) tree.extend(t) check(tree, st, notifier) notifier.failOnError() generateCode(tree, out) return