Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC][ABSTRACTION]: Initial #1260

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions jac/jaclang/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
"""The Jac Programming Language."""

from jaclang.plugin.default import ( # noqa: E402
from jaclang.plugin.default import (
JacBuiltin,
JacCmdDefaults,
JacFeatureDefaults,
JacFeatureImpl,
)
from jaclang.plugin.feature import JacFeature, pm # noqa: E402
from jaclang.plugin.feature import JacFeature, hookmanager

jac_import = JacFeature.jac_import

pm.register(JacFeatureDefaults)
pm.register(JacBuiltin)
pm.register(JacCmdDefaults)
pm.load_setuptools_entrypoints("jac")

hookmanager.register(JacFeatureImpl)
hookmanager.register(JacBuiltin)
hookmanager.register(JacCmdDefaults)
hookmanager.load_setuptools_entrypoints("jac")

__all__ = ["jac_import"]
12 changes: 7 additions & 5 deletions jac/jaclang/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
from jaclang.compiler.passes.main.schedules import py_code_gen_typed
from jaclang.compiler.passes.tool.schedules import format_pass
from jaclang.plugin.builtin import dotgen
from jaclang.plugin.feature import JacCmd as Cmd
from jaclang.plugin.feature import JacFeature as Jac
from jaclang.runtimelib.constructs import WalkerArchitype
from jaclang.runtimelib.context import ExecutionContext
from jaclang.runtimelib.implementation import WalkerArchitype
from jaclang.runtimelib.machine import JacMachine, JacProgram
from jaclang.utils.helpers import debugger as db
from jaclang.utils.lang_tools import AstTool


Cmd.create_cmd()
Jac.create_cmd()
Jac.setup()


@cmd_registry.register
Expand Down Expand Up @@ -160,7 +160,7 @@ def get_object(
data = {}
obj = Jac.get_object(id)
if obj:
data = obj.__jac__.__getstate__()
data = obj.__jac__.__serialize__()
else:
print(f"Object with id {id} not found.")

Expand Down Expand Up @@ -283,7 +283,9 @@ def enter(

jctx.set_entry_node(node)

if isinstance(architype, WalkerArchitype) and jctx.validate_access():
if isinstance(architype, WalkerArchitype) and Jac.check_read_access(
jctx.entry_node
):
Jac.spawn_call(jctx.entry_node.architype, architype)

jctx.close()
Expand Down
9 changes: 4 additions & 5 deletions jac/jaclang/plugin/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

from typing import Optional

from jaclang.plugin.feature import JacFeature as Jac
from jaclang.runtimelib.constructs import Architype, NodeArchitype
from jaclang.plugin.feature import Architype, JacFeature as Jac, NodeArchitype


def dotgen(
Expand All @@ -19,17 +18,17 @@ def dotgen(
dot_file: Optional[str] = None,
) -> str:
"""Print the dot graph."""
from jaclang.plugin.feature import pm
from jaclang.plugin.feature import JacFeature as Jac

root = pm.hook.get_root()
root = Jac.get_root()
node = node if node is not None else root
depth = depth if depth is not None else -1
traverse = traverse if traverse is not None else False
bfs = bfs if bfs is not None else True
edge_limit = edge_limit if edge_limit is not None else 512
node_limit = node_limit if node_limit is not None else 512

return pm.hook.dotgen(
return Jac.dotgen(
edge_type=edge_type,
node=node,
depth=depth,
Expand Down
Loading
Loading