jaclang 0.7.2__py3-none-any.whl → 0.7.8__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.

Files changed (95) hide show
  1. jaclang/cli/cli.py +2 -2
  2. jaclang/compiler/__init__.py +11 -12
  3. jaclang/compiler/absyntree.py +499 -294
  4. jaclang/compiler/codeloc.py +2 -2
  5. jaclang/compiler/constant.py +100 -2
  6. jaclang/compiler/jac.lark +27 -19
  7. jaclang/compiler/parser.py +119 -92
  8. jaclang/compiler/passes/main/access_modifier_pass.py +20 -12
  9. jaclang/compiler/passes/main/def_impl_match_pass.py +28 -14
  10. jaclang/compiler/passes/main/def_use_pass.py +59 -40
  11. jaclang/compiler/passes/main/fuse_typeinfo_pass.py +65 -43
  12. jaclang/compiler/passes/main/import_pass.py +8 -6
  13. jaclang/compiler/passes/main/pyast_gen_pass.py +97 -42
  14. jaclang/compiler/passes/main/pyast_load_pass.py +47 -12
  15. jaclang/compiler/passes/main/pyjac_ast_link_pass.py +19 -10
  16. jaclang/compiler/passes/main/registry_pass.py +6 -6
  17. jaclang/compiler/passes/main/sub_node_tab_pass.py +0 -5
  18. jaclang/compiler/passes/main/sym_tab_build_pass.py +43 -235
  19. jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py +21 -4
  20. jaclang/compiler/passes/main/tests/test_def_use_pass.py +5 -10
  21. jaclang/compiler/passes/main/type_check_pass.py +2 -1
  22. jaclang/compiler/passes/tool/jac_formatter_pass.py +30 -9
  23. jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +16 -0
  24. jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac +16 -0
  25. jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac +1 -1
  26. jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac +1 -1
  27. jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac +1 -1
  28. jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac +1 -1
  29. jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac +1 -1
  30. jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac +1 -1
  31. jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac +1 -1
  32. jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac +1 -1
  33. jaclang/compiler/passes/transform.py +2 -4
  34. jaclang/compiler/passes/utils/mypy_ast_build.py +1 -8
  35. jaclang/{core/registry.py → compiler/semtable.py} +1 -3
  36. jaclang/compiler/symtable.py +142 -101
  37. jaclang/compiler/tests/test_parser.py +2 -2
  38. jaclang/core/{construct.py → architype.py} +25 -240
  39. jaclang/core/constructs.py +44 -0
  40. jaclang/core/context.py +157 -0
  41. jaclang/core/importer.py +18 -9
  42. jaclang/core/memory.py +99 -0
  43. jaclang/core/test.py +90 -0
  44. jaclang/core/utils.py +2 -2
  45. jaclang/langserve/engine.py +127 -50
  46. jaclang/langserve/server.py +34 -61
  47. jaclang/langserve/tests/fixtures/base_module_structure.jac +28 -0
  48. jaclang/langserve/tests/fixtures/circle.jac +16 -12
  49. jaclang/langserve/tests/fixtures/circle_err.jac +3 -3
  50. jaclang/langserve/tests/fixtures/circle_pure.test.jac +15 -0
  51. jaclang/langserve/tests/fixtures/import_include_statements.jac +6 -0
  52. jaclang/langserve/tests/fixtures/py_import.py +26 -0
  53. jaclang/langserve/tests/test_server.py +93 -18
  54. jaclang/langserve/utils.py +124 -10
  55. jaclang/plugin/builtin.py +1 -1
  56. jaclang/plugin/default.py +25 -77
  57. jaclang/plugin/feature.py +25 -7
  58. jaclang/plugin/spec.py +18 -20
  59. jaclang/settings.py +3 -0
  60. jaclang/tests/fixtures/abc.jac +16 -12
  61. jaclang/tests/fixtures/aott_raise.jac +1 -1
  62. jaclang/tests/fixtures/byllmissue.jac +9 -0
  63. jaclang/tests/fixtures/edgetypeissue.jac +10 -0
  64. jaclang/tests/fixtures/hello.jac +1 -1
  65. jaclang/tests/fixtures/impl_match_confused.impl.jac +1 -0
  66. jaclang/tests/fixtures/impl_match_confused.jac +5 -0
  67. jaclang/tests/fixtures/maxfail_run_test.jac +17 -5
  68. jaclang/tests/fixtures/run_test.jac +17 -5
  69. jaclang/tests/test_bugs.py +19 -0
  70. jaclang/tests/test_cli.py +1 -1
  71. jaclang/tests/test_language.py +65 -100
  72. jaclang/tests/test_reference.py +1 -1
  73. jaclang/utils/lang_tools.py +5 -4
  74. jaclang/utils/test.py +2 -1
  75. jaclang/utils/treeprinter.py +22 -8
  76. {jaclang-0.7.2.dist-info → jaclang-0.7.8.dist-info}/METADATA +1 -1
  77. {jaclang-0.7.2.dist-info → jaclang-0.7.8.dist-info}/RECORD +79 -83
  78. jaclang/core/aott.py +0 -310
  79. jaclang/core/llms/__init__.py +0 -20
  80. jaclang/core/llms/anthropic.py +0 -90
  81. jaclang/core/llms/base.py +0 -206
  82. jaclang/core/llms/groq.py +0 -70
  83. jaclang/core/llms/huggingface.py +0 -76
  84. jaclang/core/llms/ollama.py +0 -81
  85. jaclang/core/llms/openai.py +0 -65
  86. jaclang/core/llms/togetherai.py +0 -63
  87. jaclang/core/llms/utils.py +0 -9
  88. jaclang/tests/fixtures/math_question.jpg +0 -0
  89. jaclang/tests/fixtures/with_llm_function.jac +0 -33
  90. jaclang/tests/fixtures/with_llm_lower.jac +0 -45
  91. jaclang/tests/fixtures/with_llm_method.jac +0 -51
  92. jaclang/tests/fixtures/with_llm_type.jac +0 -52
  93. jaclang/tests/fixtures/with_llm_vision.jac +0 -25
  94. {jaclang-0.7.2.dist-info → jaclang-0.7.8.dist-info}/WHEEL +0 -0
  95. {jaclang-0.7.2.dist-info → jaclang-0.7.8.dist-info}/entry_points.txt +0 -0
@@ -1,33 +0,0 @@
1
- import:py from jaclang.core.llms, BaseLLM;
2
-
3
- obj model:BaseLLM: {
4
- can init {
5
- self.verbose = False;
6
- self.max_tries = 1;
7
- }
8
- can __infer__(meaning_in: str, **kwargs: dict) {
9
- print(kwargs);
10
- print(meaning_in);
11
- return "[Output] Something";
12
- }
13
- }
14
- glob llm = model();
15
-
16
- glob emoji_examples: 'Examples of Text to Emoji': list[dict[str, str]] = [
17
- {
18
- "input": "I love tp drink pina coladas",
19
- "output": "👤 ❤️ 🥤 🍍🥥"
20
- },
21
- {
22
- "input": "Mime Person",
23
- "output": "👤🤲🚷"
24
- }
25
-
26
- ];
27
-
28
- can 'Get Emoji Representation'
29
- get_emoji(input: 'Text Input': str) -> 'Emoji Representation': str by llm(temperature=0.7, incl_info=(emoji_examples),excl_info=());
30
-
31
- with entry {
32
- print(get_emoji('Lets move to paris'));
33
- }
@@ -1,45 +0,0 @@
1
- import:py from jaclang.core.llms, BaseLLM;
2
-
3
- obj model:BaseLLM: {
4
- can init {
5
- self.verbose = False;
6
- self.max_tries = 1;
7
- }
8
- can __infer__(meaning_in: str, **kwargs: dict) {
9
- print(meaning_in);
10
- return '[Reasoning] J. Robert Oppenheimer, also known as the "father of the atomic bomb," was a brilliant '
11
- 'theoretical physicist and the director of the Manhattan Project during World War II. He played a crucial '
12
- 'role in developing the first nuclear weapons. However, after witnessing the devastation caused by the '
13
- 'atomic bombs dropped on Hiroshima and Nagasaki, he expressed deep regret and became an advocate for nuclear '
14
- 'disarmament. While he was an exceptional scientist, he was also known for his introspective and philosophical '
15
- 'nature, which suggests an introverted personality.\n'
16
- '[Output] Person(full_name="J. Robert Oppenheimer", yod=1967, personality=Personality.INTROVERT)';
17
- }
18
- }
19
- glob llm = model();
20
-
21
- enum 'Personality of the Person'
22
- Personality {
23
- INTROVERT: 'Person who is shy and reticent' = "Introvert",
24
- EXTROVERT: 'Person who is outgoing and socially confident' = "Extrovert"
25
- }
26
-
27
- obj 'Person'
28
- Person {
29
- has full_name: 'Fullname of the Person': str,
30
- yod: 'Year of Death': int,
31
- personality: 'Personality of the Person': Personality;
32
- }
33
-
34
- glob personality_examples: 'Personality Information of Famous People': dict[str, Personality] = {
35
- 'Albert Einstein': Personality.INTROVERT,
36
- 'Barack Obama': Personality.EXTROVERT
37
- };
38
-
39
- can 'Get Person Information use common knowledge'
40
- get_person_info(name: 'Name of the Person': str) -> 'Person': Person by llm(method="Reason");
41
-
42
- with entry {
43
- person_obj = get_person_info('Oppenheimer');
44
- print(f"{person_obj.full_name} was a {person_obj.personality.value} person who died in {person_obj.yod}");
45
- }
@@ -1,51 +0,0 @@
1
- import:py from jaclang.core.llms, BaseLLM;
2
-
3
- obj model:BaseLLM: {
4
- can init {
5
- self.verbose = False;
6
- self.max_tries = 1;
7
- }
8
- can __infer__(meaning_in: str, **kwargs: dict) {
9
- print(meaning_in);
10
- return "[Output] Something";
11
- }
12
- }
13
- glob llm = model();
14
-
15
- class 'Personality Index of a Person'
16
- PersonalityIndex {
17
- has index: 'Personality Index': int;
18
- }
19
-
20
- enum 'Personality of the Person'
21
- Personality {
22
- INTROVERT: 'Person who is shy and reticent',
23
- EXTROVERT: 'Person who is outgoing and socially confident'
24
- }
25
-
26
- glob personality_examples: 'Personality Information of Famous People': dict[str, Personality|None] = {
27
- 'Albert Einstein': Personality.INTROVERT,
28
- 'Barack Obama': Personality.EXTROVERT
29
- };
30
-
31
- obj 'Person'
32
- Person {
33
- has name: 'Name of the Person': str,
34
- age: 'Age of the Person': int;
35
- }
36
-
37
- obj 'main object '
38
- outer{
39
- obj 'inner object'
40
- inner {
41
- has diary_entries :'Diary Entries': list[str];
42
- can 'Get Personality of the Person'
43
- get_personality (person: 'Person Object': list[Person]) -> 'Personality of the Person': dict[Personality, PersonalityIndex] by llm(method="Reason", incl_info=(personality_examples, self.diary_entries));
44
- }
45
- }
46
-
47
- with entry{
48
- obj1=outer.inner(["I won noble prize in Physics", "I am popular for my theory of relativity"]);
49
- pp=Person('Albert Einstein', 76);
50
- print(obj1.get_personality(pp));
51
- }
@@ -1,52 +0,0 @@
1
- import:py from jaclang.core.llms, BaseLLM;
2
-
3
- obj model:BaseLLM: {
4
- can init(output_str: str) {
5
- self.verbose = False;
6
- self.max_tries = 1;
7
- self.output_str = output_str;
8
- }
9
- can __infer__(meaning_in: str, **kwargs: dict) {
10
- print("Meaning in: ", meaning_in);
11
- return f"[Output] {self.output_str}";
12
- }
13
- }
14
- glob llm1 = model(output_str="Person(name='Albert Einstein', dob='14/03/1879', age=76)");
15
-
16
- obj 'Person'
17
- Person {
18
- has name: 'Name of the Person': str,
19
- dob: 'Date of Birth': str,
20
- age: 'Age of the Person': int;
21
- }
22
-
23
- with entry {
24
- einstein: 'Einstein Object': Person = Person(name="Albert Einstein" by llm1());
25
- print(einstein.dob); #14/03/1879
26
- }
27
-
28
- glob llm2 = model(output_str="University.Department(name='Computer Science', head=Person(name='Jason Mars', dob='1994-01-01', age=30))");
29
-
30
- obj 'University'
31
- University {
32
- has name: 'Name of the University': str,
33
- location: 'Location of the University': str,
34
- departments: 'Departments in the University': list[self.Department] = [];
35
-
36
- obj 'Department'
37
- Department {
38
- has name: 'Name of the Department': str,
39
- head: 'Head of the Department': Person;
40
- }
41
- }
42
-
43
- with entry {
44
- umich: 'Univeristy of Michigan': University = University(name="University of Michigan", location="Ann Arbor, Michigan");
45
- cs_department: 'Computer Science Department': University.Department = University.Department(
46
- name="Computer Science" by llm2(incl_info=(umich))
47
- );
48
- print(cs_department.head); # Person(name='Jason Mars', dob='1994-01-01', age=30)
49
-
50
- umich.departments.append(umich.Department(name="Computer Science" by llm2()));
51
- print(umich.departments[0].head); # Person(name='Jason Mars', dob='1994-01-01', age=30)
52
- }
@@ -1,25 +0,0 @@
1
- import:py from jaclang.core.llms, BaseLLM;
2
- import:py from PIL, Image;
3
- import:py os;
4
-
5
- obj model:BaseLLM: {
6
- can init {
7
- self.verbose = False;
8
- self.max_tries = 1;
9
- }
10
- can __infer__(meaning_in: str, **kwargs: dict) {
11
- print(kwargs);
12
- print(meaning_in);
13
- return "[Output] Something";
14
- }
15
- }
16
- glob llm = model();
17
-
18
- can 'Solve the Given Math Question'
19
- solve_math_question(question_img: 'Image of the Question': Image) -> 'Answer to the Question': str
20
- by llm(method="Chain-of-Thoughts");
21
-
22
- with entry {
23
- question_img = Image.open(os.path.join(os.path.dirname(__file__), 'math_question.jpg'));
24
- print(solve_math_question(question_img));
25
- }