def __init__(self, symtable=None, writer=None, with_plugins=True):
        self.writer = writer or StdWriter()
        self.writer._larch = self

        if symtable is None:
            symtable = SymbolTable(larch=self)
        self.symtable   = symtable
        self._interrupt = None
        self.error      = []
        self.expr       = None
        self.retval     = None
        self.func       = None
        self.fname      = '<stdin>'
        self.lineno     = 0
        builtingroup = symtable._builtin
        mathgroup    = symtable._math
        setattr(mathgroup, 'j', 1j)

        # system-specific settings
        enable_plugins()
        site_config.system_settings()
        for sym in builtins.from_math:
            setattr(mathgroup, sym, getattr(math, sym))

        for sym in builtins.from_builtin:
            setattr(builtingroup, sym, __builtins__[sym])

        for sym in builtins.from_numpy:
            try:
                setattr(mathgroup, sym, getattr(numpy, sym))
            except __HOLE__:
                pass
        for fname, sym in list(builtins.numpy_renames.items()):
            setattr(mathgroup, fname, getattr(numpy, sym))

        for groupname, entries in builtins.local_funcs.items():
            group = getattr(symtable, groupname, None)
            if group is not None:
                for fname, fcn in list(entries.items()):
                    setattr(group, fname,
                            Closure(func=fcn, _larch=self, _name=fname))

        # set valid commands from builtins
        for cmd in builtins.valid_commands:
            self.symtable._sys.valid_commands.append(cmd)

        if with_plugins: # add all plugins in standard plugins folder
            plugins_dir = os.path.join(site_config.larchdir, 'plugins')
            loaded_plugins = []
            for pname in site_config.core_plugins:
                pdir = os.path.join(plugins_dir, pname)
                if os.path.isdir(pdir):
                    builtins._addplugin(pdir, _larch=self)
                    loaded_plugins.append(pname)

            for pname in sorted(os.listdir(plugins_dir)):
                if pname not in loaded_plugins:
                    pdir = os.path.join(plugins_dir, pname)
                    if os.path.isdir(pdir):
                        builtins._addplugin(pdir, _larch=self)
                        loaded_plugins.append(pname)

        self.on_try = self.on_tryexcept
        self.node_handlers = dict(((node, getattr(self, "on_%s" % node))
                                   for node in self.supported_nodes))
dataset/ETHPy150Open xraypy/xraylarch/lib/interpreter.py/Interpreter.__init__