This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf222f4
commit ab52996
Showing
10 changed files
with
51 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
with entry{ | ||
with entry{ | ||
p = print; | ||
|
||
p("Multiply:", 7 * 2); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
a <<= 2 | ||
print(a) | ||
c //= 4 | ||
print(c) | ||
print(c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
p=print | ||
p = print | ||
p("&:", 5 & 3) | ||
p("|:", 5 | 3) | ||
p("^:", 5 ^ 3) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
from __future__ import annotations | ||
from jaclang.plugin.feature import JacFeature as jac | ||
|
||
@jac.make_architype('walker', on_entry=[jac.DSFunc('func2', jac.RootType)], on_exit=[]) | ||
class walker_1: | ||
|
||
@jac.make_architype("walker", on_entry=[jac.DSFunc("func2", jac.RootType)], on_exit=[]) | ||
class walker_1: | ||
def func2(self, _jac_here_: jac.RootType) -> None: | ||
end = _jac_here_ | ||
i = 0 | ||
while i < 5: | ||
jac.connect(end, (end := node_1(val=i + 1)), jac.build_edge(jac.EdgeDir.OUT, None, None)) | ||
jac.connect( | ||
end, | ||
(end := node_1(val=i + 1)), | ||
jac.build_edge(jac.EdgeDir.OUT, None, None), | ||
) | ||
i += 1 | ||
if jac.visit_node(self, jac.edge_ref(_jac_here_, jac.EdgeDir.OUT, None, None)): | ||
pass | ||
|
||
@jac.make_architype('node', on_entry=[jac.DSFunc('func_1', walker_1)], on_exit=[]) | ||
|
||
@jac.make_architype("node", on_entry=[jac.DSFunc("func_1", walker_1)], on_exit=[]) | ||
class node_1: | ||
val: int | ||
|
||
def func_1(self, _jac_here_: walker_1) -> None: | ||
print('visiting ', self) | ||
print("visiting ", self) | ||
if self.val == 3: | ||
print('Disengaging traversal in node with value 3.') | ||
print("Disengaging traversal in node with value 3.") | ||
jac.disengage(_jac_here_) | ||
return | ||
if jac.visit_node(_jac_here_, jac.edge_ref(self, jac.EdgeDir.OUT, None, None)): | ||
pass | ||
else: | ||
print('finished visitng all nodes ....\n') | ||
jac.spawn_call(jac.get_root(), walker_1()) | ||
print("finished visitng all nodes ....\n") | ||
|
||
|
||
jac.spawn_call(jac.get_root(), walker_1()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
with entry{ | ||
|
||
user_language = None; | ||
preferred_language = user_language ?: 'english'; | ||
|
||
print(preferred_language); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from jaclang.plugin.feature import JacFeature as jac | ||
|
||
user_language = None | ||
preferred_language = jac.elvis(user_language, 'english') | ||
print(preferred_language) | ||
preferred_language = jac.elvis(user_language, "english") | ||
print(preferred_language) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
from __future__ import annotations | ||
x = 'Jaclang ' | ||
|
||
x = "Jaclang " | ||
|
||
|
||
def foo() -> None: | ||
global x | ||
x = 'Jaclang is ' | ||
y = 'Awesome' | ||
x = "Jaclang is " | ||
y = "Awesome" | ||
|
||
def foo2() -> tuple[str, str]: | ||
nonlocal y | ||
y = 'Fantastic' | ||
y = "Fantastic" | ||
return (x, y) | ||
|
||
print(x, y) | ||
print(foo2()) | ||
foo() | ||
|
||
|
||
foo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters