jaclang 0.5.18__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jaclang might be problematic. Click here for more details.
- jaclang/cli/cli.py +4 -2
- jaclang/compiler/__init__.py +12 -5
- jaclang/compiler/absyntree.py +3 -3
- jaclang/compiler/generated/jac_parser.py +2 -2
- jaclang/compiler/jac.lark +2 -2
- jaclang/compiler/parser.py +47 -7
- jaclang/compiler/passes/main/__init__.py +3 -2
- jaclang/compiler/passes/main/access_modifier_pass.py +173 -0
- jaclang/compiler/passes/main/import_pass.py +32 -19
- jaclang/compiler/passes/main/pyast_gen_pass.py +41 -26
- jaclang/compiler/passes/main/pyast_load_pass.py +136 -73
- jaclang/compiler/passes/main/pyout_pass.py +14 -13
- jaclang/compiler/passes/main/registry_pass.py +8 -3
- jaclang/compiler/passes/main/schedules.py +5 -3
- jaclang/compiler/passes/main/sym_tab_build_pass.py +23 -26
- jaclang/compiler/passes/main/tests/test_import_pass.py +2 -2
- jaclang/compiler/passes/tool/jac_formatter_pass.py +83 -21
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +11 -4
- jaclang/compiler/passes/transform.py +2 -0
- jaclang/compiler/symtable.py +10 -3
- jaclang/compiler/tests/test_importer.py +9 -0
- jaclang/compiler/workspace.py +17 -5
- jaclang/core/aott.py +34 -63
- jaclang/core/importer.py +73 -65
- jaclang/core/llms/__init__.py +20 -0
- jaclang/core/llms/anthropic.py +61 -0
- jaclang/core/llms/base.py +206 -0
- jaclang/core/llms/groq.py +67 -0
- jaclang/core/llms/huggingface.py +73 -0
- jaclang/core/llms/ollama.py +78 -0
- jaclang/core/llms/openai.py +61 -0
- jaclang/core/llms/togetherai.py +60 -0
- jaclang/core/llms/utils.py +9 -0
- jaclang/core/utils.py +16 -1
- jaclang/plugin/default.py +37 -14
- jaclang/plugin/feature.py +9 -6
- jaclang/plugin/spec.py +8 -1
- jaclang/settings.py +1 -1
- jaclang/utils/helpers.py +6 -2
- jaclang/utils/treeprinter.py +9 -6
- jaclang-0.6.0.dist-info/METADATA +17 -0
- {jaclang-0.5.18.dist-info → jaclang-0.6.0.dist-info}/RECORD +45 -36
- jaclang/core/llms.py +0 -111
- jaclang-0.5.18.dist-info/METADATA +0 -7
- {jaclang-0.5.18.dist-info → jaclang-0.6.0.dist-info}/WHEEL +0 -0
- {jaclang-0.5.18.dist-info → jaclang-0.6.0.dist-info}/entry_points.txt +0 -0
- {jaclang-0.5.18.dist-info → jaclang-0.6.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Ollama client for MTLLM."""
|
|
2
|
+
|
|
3
|
+
from .base import BaseLLM
|
|
4
|
+
|
|
5
|
+
REASON_SUFFIX = """
|
|
6
|
+
Reason and return the output results(s) only such that <Output> should be eval(<Output>) Compatible and reflects the
|
|
7
|
+
expected output type, Follow the format below to provide the reasoning for the output result(s).
|
|
8
|
+
|
|
9
|
+
[Reasoning] <Reasoning>
|
|
10
|
+
[Output] <Output>
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
NORMAL_SUFFIX = """Return the output result(s) only such that <Output> should be eval(<Output>) Compatible and
|
|
14
|
+
reflects the expected output type, Follow the format below to provide the output result(s).
|
|
15
|
+
|
|
16
|
+
[Output] <Output>
|
|
17
|
+
""" # noqa E501
|
|
18
|
+
|
|
19
|
+
CHAIN_OF_THOUGHT_SUFFIX = """
|
|
20
|
+
Generate and return the output result(s) only, adhering to the provided Type in the following format. Perform the operation in a chain of thoughts.(Think Step by Step)
|
|
21
|
+
|
|
22
|
+
[Chain of Thoughts] <Chain of Thoughts>
|
|
23
|
+
[Output] <Result>
|
|
24
|
+
""" # noqa E501
|
|
25
|
+
|
|
26
|
+
REACT_SUFFIX = """
|
|
27
|
+
""" # noqa E501
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Ollama(BaseLLM):
|
|
31
|
+
"""Ollama API client for Large Language Models (LLMs)."""
|
|
32
|
+
|
|
33
|
+
MTLLM_METHOD_PROMPTS: dict[str, str] = {
|
|
34
|
+
"Normal": NORMAL_SUFFIX,
|
|
35
|
+
"Reason": REASON_SUFFIX,
|
|
36
|
+
"Chain-of-Thoughts": CHAIN_OF_THOUGHT_SUFFIX,
|
|
37
|
+
"ReAct": REACT_SUFFIX,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def __init__(
|
|
41
|
+
self, verbose: bool = False, max_tries: int = 10, **kwargs: dict
|
|
42
|
+
) -> None:
|
|
43
|
+
"""Initialize the Ollama API client."""
|
|
44
|
+
import ollama # type: ignore
|
|
45
|
+
|
|
46
|
+
self.client = ollama.Client(host=kwargs.get("host", "http://localhost:11434"))
|
|
47
|
+
self.verbose = verbose
|
|
48
|
+
self.max_tries = max_tries
|
|
49
|
+
self.model_name = kwargs.get("model_name", "phi3")
|
|
50
|
+
self.default_model_params = {
|
|
51
|
+
k: v for k, v in kwargs.items() if k not in ["model_name", "host"]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
def __infer__(self, meaning_in: str, **kwargs: dict) -> str:
|
|
55
|
+
"""Infer a response from the input meaning."""
|
|
56
|
+
model = str(kwargs.get("model_name", self.model_name))
|
|
57
|
+
if not self.check_model(model):
|
|
58
|
+
self.download_model(model)
|
|
59
|
+
model_params = {k: v for k, v in kwargs.items() if k not in ["model_name"]}
|
|
60
|
+
messages = [{"role": "user", "content": meaning_in}]
|
|
61
|
+
output = self.client.chat(
|
|
62
|
+
model=model,
|
|
63
|
+
messages=messages,
|
|
64
|
+
options={**self.default_model_params, **model_params},
|
|
65
|
+
)
|
|
66
|
+
return output["message"]["content"]
|
|
67
|
+
|
|
68
|
+
def check_model(self, model_name: str) -> bool:
|
|
69
|
+
"""Check if the model is available."""
|
|
70
|
+
try:
|
|
71
|
+
self.client.show(model_name)
|
|
72
|
+
return True
|
|
73
|
+
except Exception:
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
def download_model(self, model_name: str) -> None:
|
|
77
|
+
"""Download the model."""
|
|
78
|
+
self.client.pull(model_name)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Anthropic API client for MTLLM."""
|
|
2
|
+
|
|
3
|
+
from .base import BaseLLM
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
REASON_SUFFIX = """
|
|
7
|
+
Reason and return the output result(s) only, adhering to the provided Type in the following format
|
|
8
|
+
|
|
9
|
+
[Reasoning] <Reason>
|
|
10
|
+
[Output] <Result>
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
NORMAL_SUFFIX = """Generate and return the output result(s) only, adhering to the provided Type in the following format
|
|
14
|
+
|
|
15
|
+
[Output] <result>
|
|
16
|
+
""" # noqa E501
|
|
17
|
+
|
|
18
|
+
CHAIN_OF_THOUGHT_SUFFIX = """
|
|
19
|
+
Generate and return the output result(s) only, adhering to the provided Type in the following format. Perform the operation in a chain of thoughts.(Think Step by Step)
|
|
20
|
+
|
|
21
|
+
[Chain of Thoughts] <Chain of Thoughts>
|
|
22
|
+
[Output] <Result>
|
|
23
|
+
""" # noqa E501
|
|
24
|
+
|
|
25
|
+
REACT_SUFFIX = """
|
|
26
|
+
""" # noqa E501
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class OpenAI(BaseLLM):
|
|
30
|
+
"""Anthropic API client for MTLLM."""
|
|
31
|
+
|
|
32
|
+
MTLLM_METHOD_PROMPTS: dict[str, str] = {
|
|
33
|
+
"Normal": NORMAL_SUFFIX,
|
|
34
|
+
"Reason": REASON_SUFFIX,
|
|
35
|
+
"Chain-of-Thoughts": CHAIN_OF_THOUGHT_SUFFIX,
|
|
36
|
+
"ReAct": REACT_SUFFIX,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
def __init__(
|
|
40
|
+
self, verbose: bool = False, max_tries: int = 10, **kwargs: dict
|
|
41
|
+
) -> None:
|
|
42
|
+
"""Initialize the Anthropic API client."""
|
|
43
|
+
import openai # type: ignore
|
|
44
|
+
|
|
45
|
+
self.client = openai.OpenAI()
|
|
46
|
+
self.verbose = verbose
|
|
47
|
+
self.max_tries = max_tries
|
|
48
|
+
self.model_name = kwargs.get("model_name", "gpt-3.5-turbo")
|
|
49
|
+
self.temperature = kwargs.get("temperature", 0.7)
|
|
50
|
+
self.max_tokens = kwargs.get("max_tokens", 1024)
|
|
51
|
+
|
|
52
|
+
def __infer__(self, meaning_in: str, **kwargs: dict) -> str:
|
|
53
|
+
"""Infer a response from the input meaning."""
|
|
54
|
+
messages = [{"role": "user", "content": meaning_in}]
|
|
55
|
+
output = self.client.chat.completions.create(
|
|
56
|
+
model=kwargs.get("model_name", self.model_name),
|
|
57
|
+
temperature=kwargs.get("temperature", self.temperature),
|
|
58
|
+
max_tokens=kwargs.get("max_tokens", self.max_tokens),
|
|
59
|
+
messages=messages,
|
|
60
|
+
)
|
|
61
|
+
return output.choices[0].message.content
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Anthropic API client for MTLLM."""
|
|
2
|
+
|
|
3
|
+
from .base import BaseLLM
|
|
4
|
+
|
|
5
|
+
REASON_SUFFIX = """
|
|
6
|
+
Reason and return the output result(s) only, adhering to the provided Type in the following format
|
|
7
|
+
|
|
8
|
+
[Reasoning] <Reason>
|
|
9
|
+
[Output] <Result>
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
NORMAL_SUFFIX = """Generate and return the output result(s) only, adhering to the provided Type in the following format
|
|
13
|
+
|
|
14
|
+
[Output] <result>
|
|
15
|
+
""" # noqa E501
|
|
16
|
+
|
|
17
|
+
CHAIN_OF_THOUGHT_SUFFIX = """
|
|
18
|
+
Generate and return the output result(s) only, adhering to the provided Type in the following format. Perform the operation in a chain of thoughts.(Think Step by Step)
|
|
19
|
+
|
|
20
|
+
[Chain of Thoughts] <Chain of Thoughts>
|
|
21
|
+
[Output] <Result>
|
|
22
|
+
""" # noqa E501
|
|
23
|
+
|
|
24
|
+
REACT_SUFFIX = """
|
|
25
|
+
""" # noqa E501
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class TogetherAI(BaseLLM):
|
|
29
|
+
"""Anthropic API client for MTLLM."""
|
|
30
|
+
|
|
31
|
+
MTLLM_METHOD_PROMPTS: dict[str, str] = {
|
|
32
|
+
"Normal": NORMAL_SUFFIX,
|
|
33
|
+
"Reason": REASON_SUFFIX,
|
|
34
|
+
"Chain-of-Thoughts": CHAIN_OF_THOUGHT_SUFFIX,
|
|
35
|
+
"ReAct": REACT_SUFFIX,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
def __init__(
|
|
39
|
+
self, verbose: bool = False, max_tries: int = 10, **kwargs: dict
|
|
40
|
+
) -> None:
|
|
41
|
+
"""Initialize the Anthropic API client."""
|
|
42
|
+
import together # type: ignore
|
|
43
|
+
|
|
44
|
+
self.client = together.Together()
|
|
45
|
+
self.verbose = verbose
|
|
46
|
+
self.max_tries = max_tries
|
|
47
|
+
self.model_name = kwargs.get("model_name", "mistralai/Mistral-7B-Instruct-v0.3")
|
|
48
|
+
self.temperature = kwargs.get("temperature", 0.7)
|
|
49
|
+
self.max_tokens = kwargs.get("max_tokens", 1024)
|
|
50
|
+
|
|
51
|
+
def __infer__(self, meaning_in: str, **kwargs: dict) -> str:
|
|
52
|
+
"""Infer a response from the input meaning."""
|
|
53
|
+
messages = [{"role": "user", "content": meaning_in}]
|
|
54
|
+
output = self.client.chat.completions.create(
|
|
55
|
+
model=kwargs.get("model_name", self.model_name),
|
|
56
|
+
temperature=kwargs.get("temperature", self.temperature),
|
|
57
|
+
max_tokens=kwargs.get("max_tokens", self.max_tokens),
|
|
58
|
+
messages=messages,
|
|
59
|
+
)
|
|
60
|
+
return output.choices[0].message.content
|
jaclang/core/utils.py
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import ast as ast3
|
|
6
|
-
|
|
6
|
+
import sys
|
|
7
|
+
from contextlib import contextmanager
|
|
8
|
+
from typing import Callable, Iterator, TYPE_CHECKING
|
|
7
9
|
|
|
8
10
|
import jaclang.compiler.absyntree as ast
|
|
9
11
|
from jaclang.core.registry import SemScope
|
|
@@ -12,6 +14,19 @@ if TYPE_CHECKING:
|
|
|
12
14
|
from jaclang.core.construct import NodeAnchor, NodeArchitype
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
@contextmanager
|
|
18
|
+
def sys_path_context(path: str) -> Iterator[None]:
|
|
19
|
+
"""Add a path to sys.path temporarily."""
|
|
20
|
+
novel_path = path not in sys.path
|
|
21
|
+
try:
|
|
22
|
+
if novel_path:
|
|
23
|
+
sys.path.append(path)
|
|
24
|
+
yield
|
|
25
|
+
finally:
|
|
26
|
+
if novel_path:
|
|
27
|
+
sys.path.remove(path)
|
|
28
|
+
|
|
29
|
+
|
|
15
30
|
def collect_node_connections(
|
|
16
31
|
current_node: NodeAnchor,
|
|
17
32
|
visited_nodes: set,
|
jaclang/plugin/default.py
CHANGED
|
@@ -19,7 +19,6 @@ from jaclang.core.aott import (
|
|
|
19
19
|
get_all_type_explanations,
|
|
20
20
|
get_info_types,
|
|
21
21
|
get_object_string,
|
|
22
|
-
get_reasoning_output,
|
|
23
22
|
get_type_annotation,
|
|
24
23
|
)
|
|
25
24
|
from jaclang.core.construct import (
|
|
@@ -428,10 +427,16 @@ class JacFeatureDefaults:
|
|
|
428
427
|
|
|
429
428
|
@staticmethod
|
|
430
429
|
@hookimpl
|
|
431
|
-
def get_root() ->
|
|
430
|
+
def get_root() -> Root:
|
|
432
431
|
"""Jac's assign comprehension feature."""
|
|
433
432
|
return root
|
|
434
433
|
|
|
434
|
+
@staticmethod
|
|
435
|
+
@hookimpl
|
|
436
|
+
def get_root_type() -> Type[Root]:
|
|
437
|
+
"""Jac's root getter."""
|
|
438
|
+
return Root
|
|
439
|
+
|
|
435
440
|
@staticmethod
|
|
436
441
|
@hookimpl
|
|
437
442
|
def build_edge(
|
|
@@ -587,9 +592,15 @@ class JacFeatureDefaults:
|
|
|
587
592
|
_scope = SemScope.get_scope_from_str(scope)
|
|
588
593
|
assert _scope is not None
|
|
589
594
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
595
|
+
method = model_params.pop("method") if "method" in model_params else "Normal"
|
|
596
|
+
available_methods = model.MTLLM_METHOD_PROMPTS.keys()
|
|
597
|
+
assert (
|
|
598
|
+
method in available_methods
|
|
599
|
+
), f"Invalid method: {method}. Select from {available_methods}"
|
|
600
|
+
|
|
601
|
+
context = (
|
|
602
|
+
"\n".join(model_params.pop("context")) if "context" in model_params else ""
|
|
603
|
+
)
|
|
593
604
|
|
|
594
605
|
type_collector: list = []
|
|
595
606
|
information, collected_types = get_info_types(_scope, mod_registry, incl_info)
|
|
@@ -605,22 +616,34 @@ class JacFeatureDefaults:
|
|
|
605
616
|
|
|
606
617
|
output_information = f"{outputs[0]} ({outputs[1]})"
|
|
607
618
|
type_collector.extend(extract_non_primary_type(outputs[1]))
|
|
619
|
+
output_type_explanations = "\n".join(
|
|
620
|
+
list(
|
|
621
|
+
get_all_type_explanations(
|
|
622
|
+
extract_non_primary_type(outputs[1]), mod_registry
|
|
623
|
+
).values()
|
|
624
|
+
)
|
|
625
|
+
)
|
|
608
626
|
|
|
609
627
|
type_explanations_list = list(
|
|
610
628
|
get_all_type_explanations(type_collector, mod_registry).values()
|
|
611
629
|
)
|
|
612
630
|
type_explanations = "\n".join(type_explanations_list)
|
|
613
631
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
632
|
+
meaning_out = aott_raise(
|
|
633
|
+
model=model,
|
|
634
|
+
information=information,
|
|
635
|
+
inputs_information=inputs_information,
|
|
636
|
+
output_information=output_information,
|
|
637
|
+
type_explanations=type_explanations,
|
|
638
|
+
action=action,
|
|
639
|
+
context=context,
|
|
640
|
+
method=method,
|
|
641
|
+
tools=[],
|
|
642
|
+
model_params=model_params,
|
|
643
|
+
)
|
|
644
|
+
output = model.resolve_output(
|
|
645
|
+
meaning_out, outputs[0], outputs[1], output_type_explanations
|
|
621
646
|
)
|
|
622
|
-
meaning_out = model.__infer__(meaning_in, **model_params)
|
|
623
|
-
reasoning, output = get_reasoning_output(meaning_out)
|
|
624
647
|
return output
|
|
625
648
|
|
|
626
649
|
|
jaclang/plugin/feature.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import types
|
|
6
|
-
from typing import Any, Callable, Optional, Type,
|
|
6
|
+
from typing import Any, Callable, Optional, Type, Union
|
|
7
7
|
|
|
8
8
|
from jaclang.compiler.absyntree import Module
|
|
9
9
|
from jaclang.core.construct import (
|
|
@@ -31,8 +31,6 @@ class JacFeature:
|
|
|
31
31
|
from jaclang.plugin.spec import DSFunc
|
|
32
32
|
from jaclang.compiler.constant import EdgeDir
|
|
33
33
|
|
|
34
|
-
RootType: TypeAlias = Root
|
|
35
|
-
|
|
36
34
|
@staticmethod
|
|
37
35
|
def make_architype(
|
|
38
36
|
cls: type,
|
|
@@ -82,7 +80,7 @@ class JacFeature:
|
|
|
82
80
|
mdl_alias: Optional[str] = None,
|
|
83
81
|
override_name: Optional[str] = None,
|
|
84
82
|
mod_bundle: Optional[Module] = None,
|
|
85
|
-
lng: Optional[str] =
|
|
83
|
+
lng: Optional[str] = "jac",
|
|
86
84
|
items: Optional[dict[str, Union[str, bool]]] = None,
|
|
87
85
|
) -> Optional[types.ModuleType]:
|
|
88
86
|
"""Core Import Process."""
|
|
@@ -218,10 +216,15 @@ class JacFeature:
|
|
|
218
216
|
return pm.hook.assign_compr(target=target, attr_val=attr_val)
|
|
219
217
|
|
|
220
218
|
@staticmethod
|
|
221
|
-
def get_root() ->
|
|
222
|
-
"""Jac's
|
|
219
|
+
def get_root() -> Root:
|
|
220
|
+
"""Jac's root getter."""
|
|
223
221
|
return pm.hook.get_root()
|
|
224
222
|
|
|
223
|
+
@staticmethod
|
|
224
|
+
def get_root_type() -> Type[Root]:
|
|
225
|
+
"""Jac's root type getter."""
|
|
226
|
+
return pm.hook.get_root_type()
|
|
227
|
+
|
|
225
228
|
@staticmethod
|
|
226
229
|
def build_edge(
|
|
227
230
|
is_undirected: bool,
|
jaclang/plugin/spec.py
CHANGED
|
@@ -12,6 +12,7 @@ from jaclang.plugin.default import (
|
|
|
12
12
|
EdgeArchitype,
|
|
13
13
|
EdgeDir,
|
|
14
14
|
NodeArchitype,
|
|
15
|
+
Root,
|
|
15
16
|
WalkerArchitype,
|
|
16
17
|
)
|
|
17
18
|
|
|
@@ -198,7 +199,13 @@ class JacFeatureSpec:
|
|
|
198
199
|
|
|
199
200
|
@staticmethod
|
|
200
201
|
@hookspec(firstresult=True)
|
|
201
|
-
def get_root() ->
|
|
202
|
+
def get_root() -> Root:
|
|
203
|
+
"""Jac's root getter."""
|
|
204
|
+
raise NotImplementedError
|
|
205
|
+
|
|
206
|
+
@staticmethod
|
|
207
|
+
@hookspec(firstresult=True)
|
|
208
|
+
def get_root_type() -> Type[Root]:
|
|
202
209
|
"""Jac's root getter."""
|
|
203
210
|
raise NotImplementedError
|
|
204
211
|
|
jaclang/settings.py
CHANGED
jaclang/utils/helpers.py
CHANGED
|
@@ -131,7 +131,6 @@ def import_target_to_relative_path(
|
|
|
131
131
|
import_level: int,
|
|
132
132
|
import_target: str,
|
|
133
133
|
base_path: Optional[str] = None,
|
|
134
|
-
file_extension: str = ".jac",
|
|
135
134
|
) -> str:
|
|
136
135
|
"""Convert an import target string into a relative file path."""
|
|
137
136
|
if not base_path:
|
|
@@ -141,7 +140,12 @@ def import_target_to_relative_path(
|
|
|
141
140
|
actual_parts = parts[traversal_levels:]
|
|
142
141
|
for _ in range(traversal_levels):
|
|
143
142
|
base_path = os.path.dirname(base_path)
|
|
144
|
-
relative_path = os.path.join(base_path, *actual_parts)
|
|
143
|
+
relative_path = os.path.join(base_path, *actual_parts)
|
|
144
|
+
relative_path = (
|
|
145
|
+
relative_path + ".jac"
|
|
146
|
+
if os.path.exists(relative_path + ".jac")
|
|
147
|
+
else relative_path
|
|
148
|
+
)
|
|
145
149
|
return relative_path
|
|
146
150
|
|
|
147
151
|
|
jaclang/utils/treeprinter.py
CHANGED
|
@@ -88,16 +88,19 @@ def print_ast_tree(
|
|
|
88
88
|
from jaclang.compiler.absyntree import AstSymbolNode, Token
|
|
89
89
|
|
|
90
90
|
def __node_repr_in_tree(node: AstNode) -> str:
|
|
91
|
+
access = (
|
|
92
|
+
f"Access: {node.access.tag.value}"
|
|
93
|
+
if isinstance(node, ast.AstAccessNode) and node.access is not None
|
|
94
|
+
else ""
|
|
95
|
+
)
|
|
91
96
|
if isinstance(node, Token) and isinstance(node, AstSymbolNode):
|
|
92
|
-
return
|
|
93
|
-
f"{node.__class__.__name__} - {node.value} - Type: {node.sym_info.typ}"
|
|
94
|
-
)
|
|
97
|
+
return f"{node.__class__.__name__} - {node.value} - Type: {node.sym_info.typ}, {access}"
|
|
95
98
|
elif isinstance(node, Token):
|
|
96
|
-
return f"{node.__class__.__name__} - {node.value}"
|
|
99
|
+
return f"{node.__class__.__name__} - {node.value}, {access}"
|
|
97
100
|
elif isinstance(node, AstSymbolNode):
|
|
98
|
-
return f"{node.__class__.__name__} - {node.sym_name} - Type: {node.sym_info.typ}"
|
|
101
|
+
return f"{node.__class__.__name__} - {node.sym_name} - Type: {node.sym_info.typ}, {access}"
|
|
99
102
|
else:
|
|
100
|
-
return f"{node.__class__.__name__}"
|
|
103
|
+
return f"{node.__class__.__name__}, {access}"
|
|
101
104
|
|
|
102
105
|
def __node_repr_in_py_tree(node: ast3.AST) -> str:
|
|
103
106
|
if isinstance(node, ast3.Constant):
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: jaclang
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Home-page: https://github.com/Jaseci-Labs/jaclang
|
|
5
|
+
Author: Jason Mars
|
|
6
|
+
Author-email: jason@jaseci.org
|
|
7
|
+
Provides-Extra: llms
|
|
8
|
+
Requires-Dist: transformers ; extra == 'llms'
|
|
9
|
+
Requires-Dist: accelerator ; extra == 'llms'
|
|
10
|
+
Requires-Dist: torch ; extra == 'llms'
|
|
11
|
+
Requires-Dist: ollama ; extra == 'llms'
|
|
12
|
+
Requires-Dist: anthropic ; extra == 'llms'
|
|
13
|
+
Requires-Dist: groq ; extra == 'llms'
|
|
14
|
+
Requires-Dist: openai ; extra == 'llms'
|
|
15
|
+
Requires-Dist: together ; extra == 'llms'
|
|
16
|
+
Requires-Dist: loguru ; extra == 'llms'
|
|
17
|
+
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
jaclang/__init__.py,sha256=vTvt9LIz5RNKrLRueH3gUM3KTAjsqoanHQ_Pn9m4i9g,675
|
|
2
|
-
jaclang/settings.py,sha256=
|
|
2
|
+
jaclang/settings.py,sha256=2bLDsF1xiFI9VL8vEIPZ5A5Q-XQ9hfK9lIszH99nKkc,3156
|
|
3
3
|
jaclang/cli/__init__.py,sha256=7aaPgYddIAHBvkdv36ngbfwsimMnfGaTDcaHYMg_vf4,23
|
|
4
|
-
jaclang/cli/cli.py,sha256=
|
|
4
|
+
jaclang/cli/cli.py,sha256=O4obezeiQKGsYqt4_ZN3pGBL7xjA2d_wcxgEVqZ959g,10806
|
|
5
5
|
jaclang/cli/cmdreg.py,sha256=bn2UdOkNbE-4zfbomO2j8rTtkXhsltH4jE5rKqA5HbY,7862
|
|
6
|
-
jaclang/compiler/__init__.py,sha256=
|
|
7
|
-
jaclang/compiler/absyntree.py,sha256=
|
|
6
|
+
jaclang/compiler/__init__.py,sha256=Fq2rBjvbFxTbolEC872X5CicOjyJmKo0yZlnUcChg6k,3119
|
|
7
|
+
jaclang/compiler/absyntree.py,sha256=VBqAZZQ9zRS73M55nZaATBoHzlDtRv86ogwyM4fjPZ0,126939
|
|
8
8
|
jaclang/compiler/codeloc.py,sha256=KMwf5OMQu3_uDjIdH7ta2piacUtXNPgUV1t8OuLjpzE,2828
|
|
9
9
|
jaclang/compiler/compile.py,sha256=fS6Uvor93EavESKrwadqp7bstcpMRRACvBkqbr4En04,2682
|
|
10
10
|
jaclang/compiler/constant.py,sha256=C8nOgWLAg-fRg8Qax_jRcYp6jGyWSSA1gwzk9Zdy7HE,6534
|
|
11
|
-
jaclang/compiler/jac.lark,sha256=
|
|
12
|
-
jaclang/compiler/parser.py,sha256=
|
|
13
|
-
jaclang/compiler/symtable.py,sha256=
|
|
14
|
-
jaclang/compiler/workspace.py,sha256=
|
|
11
|
+
jaclang/compiler/jac.lark,sha256=Kvq5zZbQMJ-1bdXLVuCafRVS9w91UfN-0nLnEq0gOSw,17019
|
|
12
|
+
jaclang/compiler/parser.py,sha256=EtASMImnMyrKXixKpHYStBlhdDxVwtsIX306EWC8AHg,138177
|
|
13
|
+
jaclang/compiler/symtable.py,sha256=f-9c3eQJTDhEG22kYC3Vd4i5gRWf77_CsqFm7t8Wsng,6031
|
|
14
|
+
jaclang/compiler/workspace.py,sha256=I1MF2jaSylDOcQQV4Ez3svi4FdOyfmbNupuZT7q9aFQ,7797
|
|
15
15
|
jaclang/compiler/generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
jaclang/compiler/generated/jac_parser.py,sha256=
|
|
16
|
+
jaclang/compiler/generated/jac_parser.py,sha256=Dn9D__4gJTGRYcfXgbkcwICHXe1qwMs2x0MkSuN3U_U,338234
|
|
17
17
|
jaclang/compiler/passes/__init__.py,sha256=0Tw0d130ZjzA05jVcny9cf5NfLjlaM70PKqFnY4zqn4,69
|
|
18
18
|
jaclang/compiler/passes/ir_pass.py,sha256=gh1Zd8ouu79FoxerW1sMxktmfeC9gHyp4H_MoAviYP8,5504
|
|
19
|
-
jaclang/compiler/passes/transform.py,sha256=
|
|
20
|
-
jaclang/compiler/passes/main/__init__.py,sha256=
|
|
19
|
+
jaclang/compiler/passes/transform.py,sha256=Z3TuHMJ7TyyBHt0XmRWEjMk8-t6logKs7XG_OTDJIvo,2162
|
|
20
|
+
jaclang/compiler/passes/main/__init__.py,sha256=m8vZ0F6EiwOm0e0DWKRYgc8JcgiT2ayBrY6GojZkTfY,945
|
|
21
|
+
jaclang/compiler/passes/main/access_modifier_pass.py,sha256=1tQJ9bNlOVX3sgL0DK4jv643Pu5xl68oL8LNsaHf-MY,4864
|
|
21
22
|
jaclang/compiler/passes/main/def_impl_match_pass.py,sha256=_KgAVVzMAatigKDp1vAnhyY2GcWf0rRoD8MkfYg-POU,3297
|
|
22
23
|
jaclang/compiler/passes/main/def_use_pass.py,sha256=d2REmfme2HjUj8avDcXUuPbv3yKfvYHqpL49sxniLhQ,8576
|
|
23
24
|
jaclang/compiler/passes/main/fuse_typeinfo_pass.py,sha256=9WrF78r4cNWnDqofx225b9cUZafTi3HwCffXINmgoZ0,15968
|
|
24
|
-
jaclang/compiler/passes/main/import_pass.py,sha256=
|
|
25
|
-
jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=
|
|
26
|
-
jaclang/compiler/passes/main/pyast_load_pass.py,sha256=
|
|
25
|
+
jaclang/compiler/passes/main/import_pass.py,sha256=JdDcAI2MmdJbisSSsgWHcKnuEmE_PmywSV7G9OzPras,6740
|
|
26
|
+
jaclang/compiler/passes/main/pyast_gen_pass.py,sha256=L24aRhoXIGoXu1FwwW2X3HoGWwjLmOAtbLCGqOrix0g,138795
|
|
27
|
+
jaclang/compiler/passes/main/pyast_load_pass.py,sha256=UDbosNQ88CcfSW1wKBYgLRz3ZBxpJ8cGwpn_KZaYvvk,89725
|
|
27
28
|
jaclang/compiler/passes/main/pybc_gen_pass.py,sha256=CjA9AqyMO3Pv_b5Hh0YI6JmCqIru2ASonO6rhrkau-M,1336
|
|
28
|
-
jaclang/compiler/passes/main/pyout_pass.py,sha256=
|
|
29
|
-
jaclang/compiler/passes/main/registry_pass.py,sha256=
|
|
30
|
-
jaclang/compiler/passes/main/schedules.py,sha256=
|
|
29
|
+
jaclang/compiler/passes/main/pyout_pass.py,sha256=clJkASFiBiki5w0MQXYIwcdvahYETgqAjKlYOYVYKNQ,3137
|
|
30
|
+
jaclang/compiler/passes/main/registry_pass.py,sha256=Lp_EqlflXkSgQuJe_EVBtzC16YAJx70bDO6X0nJIX5U,4579
|
|
31
|
+
jaclang/compiler/passes/main/schedules.py,sha256=Mvwt3aphVh4rhs8Mf5itK4GCIPM00rQ2a4tDzjmAzUk,1167
|
|
31
32
|
jaclang/compiler/passes/main/sub_node_tab_pass.py,sha256=fGgK0CBWsuD6BS4BsLwXPl1b5UC2N2YEOGa6jNMu8N8,1332
|
|
32
|
-
jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=
|
|
33
|
+
jaclang/compiler/passes/main/sym_tab_build_pass.py,sha256=TXM_oxTYIyKEXm2NDh6UgKw5KGPgYC1ONEqS4nN5PMQ,41769
|
|
33
34
|
jaclang/compiler/passes/main/type_check_pass.py,sha256=-f41Ukr3B1w4rkQdZ2xJy6nozymgnVKjJ8E1fn7qJmI,3339
|
|
34
35
|
jaclang/compiler/passes/main/tests/__init__.py,sha256=UBAATLUEH3yuBN4LYKnXXV79kokRc4XB-rX12qfu0ds,28
|
|
35
36
|
jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py,sha256=QDsvTEpJt3AuS3GRwfq-1mezRCpx7rwEEyg1AbusaBs,1374
|
|
36
37
|
jaclang/compiler/passes/main/tests/test_def_use_pass.py,sha256=dmyZgXugOCN-_YY7dxkNHgt8vqey8qzNJf8sWyLLZ5w,1013
|
|
37
|
-
jaclang/compiler/passes/main/tests/test_import_pass.py,sha256=
|
|
38
|
+
jaclang/compiler/passes/main/tests/test_import_pass.py,sha256=iFyrdmNuoi1C25qkL7kyUXd55Exl3Cb0iP8vRZQKsC0,586
|
|
38
39
|
jaclang/compiler/passes/main/tests/test_pyast_build_pass.py,sha256=LIT4TP-nhtftRtY5rNySRQlim-dWMSlkfUvkhZTk4pc,1383
|
|
39
40
|
jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py,sha256=fNL_FS26AQGlRCvwWfl-Qyt7iW2_A99GIHOAnnkpw9A,4731
|
|
40
41
|
jaclang/compiler/passes/main/tests/test_pybc_gen_pass.py,sha256=If8PE4exN5g9o1NRElNC0XdfIwJAp7M7f69rzmYRYUQ,655
|
|
@@ -45,40 +46,48 @@ jaclang/compiler/passes/main/tests/test_type_check_pass.py,sha256=bzrVcsBZra2HkQ
|
|
|
45
46
|
jaclang/compiler/passes/main/tests/test_typeinfo_pass.py,sha256=ehC0_giLg7NwB7fR10nW5Te8mZ76qmUFxkK1bEjtmrw,129
|
|
46
47
|
jaclang/compiler/passes/tool/__init__.py,sha256=xekCOXysHIcthWm8NRmQoA1Ah1XV8vFbkfeHphJtUdc,223
|
|
47
48
|
jaclang/compiler/passes/tool/fuse_comments_pass.py,sha256=N9a84qArNuTXX1iaXsBzqcufx6A3zYq2p-1ieH6FmHc,3133
|
|
48
|
-
jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=
|
|
49
|
+
jaclang/compiler/passes/tool/jac_formatter_pass.py,sha256=oYXDWWlxYj0FGXxXUOPnmwnkFPmayd2fRoWngvDgXwc,86113
|
|
49
50
|
jaclang/compiler/passes/tool/schedules.py,sha256=kmbsCazAMizGAdQuZpFky5BPlYlMXqNw7wOUzdi_wBo,432
|
|
50
51
|
jaclang/compiler/passes/tool/tests/__init__.py,sha256=AeOaZjA1rf6VAr0JqIit6jlcmOzW7pxGr4U1fOwgK_Y,24
|
|
51
52
|
jaclang/compiler/passes/tool/tests/test_fuse_comments_pass.py,sha256=ZeWHsm7VIyyS8KKpoB2SdlHM4jF22fMfSrfTfxt2MQw,398
|
|
52
|
-
jaclang/compiler/passes/tool/tests/test_jac_format_pass.py,sha256=
|
|
53
|
+
jaclang/compiler/passes/tool/tests/test_jac_format_pass.py,sha256=P4vBRbwVAkb8svFSAOf4VKioZS8BkoaVfYdn-LCrRqA,6144
|
|
53
54
|
jaclang/compiler/passes/tool/tests/test_unparse_validate.py,sha256=Tg9k7BOSkWngAZLvSHmPt95ILJzdIvdHxKBT__mgpS0,2910
|
|
54
55
|
jaclang/compiler/passes/utils/__init__.py,sha256=UsI5rUopTUiStAzup4kbPwIwrnC5ofCrqWBCBbM2-k4,35
|
|
55
56
|
jaclang/compiler/passes/utils/mypy_ast_build.py,sha256=0EJGhsdcIQoXeUbHlqZrPMa9XD69BZ5RcamrfOLKdk4,26057
|
|
56
57
|
jaclang/compiler/tests/__init__.py,sha256=qiXa5UNRBanGOcplFKTT9a_9GEyiv7goq1OzuCjDCFE,27
|
|
57
|
-
jaclang/compiler/tests/test_importer.py,sha256=
|
|
58
|
+
jaclang/compiler/tests/test_importer.py,sha256=JNmte5FsHhnng9jzw7N5BenflAFCasuhezN1sytDVyg,1739
|
|
58
59
|
jaclang/compiler/tests/test_parser.py,sha256=C81mUo8EGwypPTTLRVS9BglP0Dyye9xaPSQtw7cwnnI,4814
|
|
59
60
|
jaclang/compiler/tests/test_workspace.py,sha256=SEBcvz_daTbonrLHK9FbjiH86TUbOtVGH-iZ3xkJSMk,3184
|
|
60
61
|
jaclang/compiler/tests/fixtures/__init__.py,sha256=udQ0T6rajpW_nMiYKJNckqP8izZ-pH3P4PNTJEln2NU,36
|
|
61
62
|
jaclang/compiler/tests/fixtures/activity.py,sha256=fSvxYDKufsPeQIrbuh031zHw_hdbRv5iK9mS7dD8E54,263
|
|
62
63
|
jaclang/core/__init__.py,sha256=jDDYBCV82qPhmcDVk3NIvHbhng0ebSrXD3xrojg0-eo,34
|
|
63
|
-
jaclang/core/aott.py,sha256=
|
|
64
|
+
jaclang/core/aott.py,sha256=vqnoEwmAaLlasUDVI6k3d67OtqMquJ1YtgFELvLnKqk,7068
|
|
64
65
|
jaclang/core/construct.py,sha256=_mYHEbUPY3Dn0rcl21eJXLqAGYH_0_C-x1K9HDa2RKk,13633
|
|
65
|
-
jaclang/core/importer.py,sha256=
|
|
66
|
-
jaclang/core/llms.py,sha256=bs0EoQcIZc_45HSxDHSEwUgyw-YhawfX4kQYM16UNnk,4139
|
|
66
|
+
jaclang/core/importer.py,sha256=gVJhQz7nKlIAzx7FF19cgmFQd_iRQuZ19Yz2SShLCPU,6020
|
|
67
67
|
jaclang/core/registry.py,sha256=4uuXahPN4SMVEWwJ6Gjm5LM14rePMGoyjQtSbDQmQZs,4178
|
|
68
|
-
jaclang/core/utils.py,sha256=
|
|
68
|
+
jaclang/core/utils.py,sha256=5e4DyjtSweFxKeIuEyeYGV2MsuTtfnncfIwRdoyFdys,7736
|
|
69
|
+
jaclang/core/llms/__init__.py,sha256=hxuxduH6ahhkXgJ9eUkhfn8LCS1KTz1ESuYgtspu_c0,371
|
|
70
|
+
jaclang/core/llms/anthropic.py,sha256=JmgKLUTk27Hg221rt4QBLRjonxE_qLkkSgZuLFZUrCg,1979
|
|
71
|
+
jaclang/core/llms/base.py,sha256=IOQWOP3zyPq05PVq7iYmh5wTd62m2W0husljvRtLYJo,6082
|
|
72
|
+
jaclang/core/llms/groq.py,sha256=jdcz8DMz4ResI2_0pfJB1rJ8Z8r9f0Av66D3ha0fCB4,2144
|
|
73
|
+
jaclang/core/llms/huggingface.py,sha256=8NqPScBFhodjONc4SbJ1OHyftQ1y9q_a7QevprDeArQ,2656
|
|
74
|
+
jaclang/core/llms/ollama.py,sha256=mlNf844qgiBizVRRBfQt-pM8sN6dX7ESqdo2SXu8aE0,2691
|
|
75
|
+
jaclang/core/llms/openai.py,sha256=uG4BIW8x9NhWMhy9taqb4esIa3POO_cezsZ7ZclLan8,1975
|
|
76
|
+
jaclang/core/llms/togetherai.py,sha256=MTPz7QasO2MjDn8hVCjOVU3SO6H6pF9Qoh7ZHmx46yw,2005
|
|
77
|
+
jaclang/core/llms/utils.py,sha256=mTpROnh4qS8fE26TkcotSt-mAqWoSeEeRBOu0SgoPmA,219
|
|
69
78
|
jaclang/plugin/__init__.py,sha256=qLbQ2KjwyTvlV50Q7JTIznyIzuGDPjuwM_ZJjdk-avo,182
|
|
70
79
|
jaclang/plugin/builtin.py,sha256=D1R4GGNHX96P-wZnGm9OI4dMeCJvuXuHkCw2Cl5vaAU,1201
|
|
71
|
-
jaclang/plugin/default.py,sha256=
|
|
72
|
-
jaclang/plugin/feature.py,sha256=
|
|
73
|
-
jaclang/plugin/spec.py,sha256=
|
|
80
|
+
jaclang/plugin/default.py,sha256=QuhAIMZ3Flhn4UVFm8vWVmAfAbqEFx_ekhqb84VO8og,24458
|
|
81
|
+
jaclang/plugin/feature.py,sha256=u4UCLIaZ8DKhtpfKclfC3TUmx-SHfRttUdtgLrHo3Io,8853
|
|
82
|
+
jaclang/plugin/spec.py,sha256=tPeekVbwxyBE2xlkff3FXxfQkAaFsyPKPX_5FjUwfPs,7968
|
|
74
83
|
jaclang/plugin/tests/__init__.py,sha256=rn_tNG8jCHWwBc_rx4yFkGc4N1GISb7aPuTFVRTvrTk,38
|
|
75
84
|
jaclang/plugin/tests/test_features.py,sha256=uNQ52HHc0GiOGg5xUZk-ddafdtud0IHN4H_EUAs4er4,3547
|
|
76
85
|
jaclang/utils/__init__.py,sha256=86LQ_LDyWV-JFkYBpeVHpLaVxkqwFDP60XpWXOFZIQk,46
|
|
77
|
-
jaclang/utils/helpers.py,sha256=
|
|
86
|
+
jaclang/utils/helpers.py,sha256=6tfu2paCSSAUzJMZlMVl4ftbf9HOWN4TaJz7U-S0G1g,5831
|
|
78
87
|
jaclang/utils/lang_tools.py,sha256=odv66Os8bJvw9JIUUkccGWvEPL98c-60veAiOiNyTy4,9956
|
|
79
88
|
jaclang/utils/log.py,sha256=G8Y_DnETgTh9xzvlW5gh9zqJ1ap4YY_MDTwIMu5Uc0Y,262
|
|
80
89
|
jaclang/utils/test.py,sha256=7-2Te0GQcKY3RJfNKa3cEJjG-RMC1r-0fHuOcFXrmE8,5383
|
|
81
|
-
jaclang/utils/treeprinter.py,sha256=
|
|
90
|
+
jaclang/utils/treeprinter.py,sha256=wRWUaEVxnNdcbTYyQ5PJiSJ2PI4UoNTZzHadwSZ_eUE,11117
|
|
82
91
|
jaclang/utils/tests/__init__.py,sha256=8uwVqMsc6cxBAM1DuHLuNuTnzLXqOqM-WRa4ixOMF6w,23
|
|
83
92
|
jaclang/utils/tests/test_lang_tools.py,sha256=YmV1AWieSoqcxWJYnxX1Lz3dZAR0rRvz6billsGJdHY,4144
|
|
84
93
|
jaclang/vendor/__init__.py,sha256=pbflH5hBfDiKfTJEjIXId44Eof8CVmXQlZwFYDG6_4E,35
|
|
@@ -410,8 +419,8 @@ jaclang/vendor/pluggy/_manager.py,sha256=fcYU7VER0CplRym4jAJ7RCFYl6cfDSeVM589YHH
|
|
|
410
419
|
jaclang/vendor/pluggy/_result.py,sha256=wXDoVy68bOaOrBzQ0bWFb3HTbpqhvdQMgYwaZvfzxfA,3239
|
|
411
420
|
jaclang/vendor/pluggy/_tracing.py,sha256=kSBr25F_rNklV2QhLD6h1jx6Z1kcKDRbuYvF5jv35pU,2089
|
|
412
421
|
jaclang/vendor/pluggy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
413
|
-
jaclang-0.
|
|
414
|
-
jaclang-0.
|
|
415
|
-
jaclang-0.
|
|
416
|
-
jaclang-0.
|
|
417
|
-
jaclang-0.
|
|
422
|
+
jaclang-0.6.0.dist-info/METADATA,sha256=oFL9x1Tyx0ZnVcb1BKmakhCSneRit3Qtabu7QOGiQXk,546
|
|
423
|
+
jaclang-0.6.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
424
|
+
jaclang-0.6.0.dist-info/entry_points.txt,sha256=Z-snS3MDBdV1Z4znXDZTenyyndovaNjqRkDW1t2kYSs,50
|
|
425
|
+
jaclang-0.6.0.dist-info/top_level.txt,sha256=ZOAoLpE67ozkUJd-v3C59wBNXiteRD8IWPbsYB3M08g,8
|
|
426
|
+
jaclang-0.6.0.dist-info/RECORD,,
|