Skip to content

Appendices

In this part:


KeywordCategoryDescription
absModifierAbstract method/class (note: NOT abstract)
andOperatorLogical AND (also &&)
asImportAlias
assertStatementAssertion
asyncModifierAsync function/walker
awaitExpressionAwait async
breakControlExit loop
byOperatorDelegation operator (used by byllm for LLM)
canDeclarationAbility (method on archetypes)
caseControlMatch/switch case
clBlockClient-side code block
classArchetypePython-style class definition
continueControlNext iteration
defDeclarationFunction
defaultControlSwitch default case
delStatementDelete node/edge
disengageOSPStop walker traversal
edgeArchetypeEdge type
elifControlElse if
elseControlElse branch
entryOSPEntry event trigger
enumArchetypeEnumeration
exceptControlException handler
exitOSPExit event trigger
finallyControlFinally block
flowConcurrencyStart concurrent task
forControlFor loop
fromImportImport from
globDeclarationGlobal variable
globalScopeAccess global scope
hasDeclarationInstance field
hereOSPCurrent node (in walker)
ifControlConditional
implDeclarationImplementation block
importModuleImport
inOperatorMembership
includeModuleInclude/merge code
initMethodConstructor
isOperatorIdentity
lambdaExpressionAnonymous function
matchControlPattern match
nodeArchetypeNode type
nonlocalScopeAccess nonlocal scope
notOperatorLogical NOT
objArchetypeObject/class
orOperatorLogical OR (also ||)
overrideModifierOverride method
postinitMethodPost-constructor
privAccessPrivate
propsReferenceJSX props (client-side)
protectAccessProtected
pubAccessPublic
raiseStatementRaise exception
reportOSPReport value from walker
returnStatementReturn value
rootOSPRoot node reference
selfReferenceCurrent instance
semDeclarationSemantic string
skipControlSkip (nested context)
spawnOSPSpawn walker
staticModifierStatic member
superReferenceParent class
svBlockServer-side code block
switchControlSwitch statement
testDeclarationTest block
toControlFor loop upper bound
tryControlTry block
visitorOSPVisiting walker (in node)
waitConcurrencyWait for concurrent result
walkerArchetypeWalker type
whileControlWhile loop
withStatementContext manager / entry block
yieldStatementGenerator yield

Notes:

  • The abstract keyword is abs, not abstract
  • Logical operators have both word and symbol forms: and/&&, or/||
  • cl and sv are block keywords for client/server code separation

OperatorDescription
+Addition
-Subtraction
*Multiplication
/Division
//Floor division
%Modulo
**Power
OperatorDescription
==Equal
!=Not equal
<Less than
>Greater than
<=Less or equal
>=Greater or equal
OperatorDescription
and, &&Logical AND
or, ||Logical OR
notLogical NOT
OperatorDescription
++>Forward connect
<++Backward connect
<++>Bidirectional connect
+>:T:+>Typed forward
<+:T:<+Typed backward
<+:T:+>Typed bidirectional
[-->]Outgoing edges
[<--]Incoming edges
[<-->]All edges
OperatorDescription
|>Forward pipe
<|Backward pipe
:>Atomic forward
<:Atomic backward

module : STRING? element* # Optional module docstring
element : STRING? toplevel_stmt # Optional statement docstring
toplevel_stmt : import | archetype | ability | impl | test | entry
| (cl | sv) toplevel_stmt # Client/server prefix
| (cl | sv) "{" toplevel_stmt* "}" # Client/server block
archetype : async? (obj | node | edge | walker | enum) NAME inheritance? body
inheritance : "(" NAME ("," NAME)* ")"
body : "{" member* "}"
member : has_stmt | ability | impl
has_stmt : "has" (modifier)? NAME ":" type ("=" expr)? ";"
ability : async? "can" NAME params? ("->" type)? event_clause? (body | ";")
event_clause : "with" type_expr? (entry | exit)
import : "import" (module | "from" import_path "{" names "}")
import_path : (NAME ":")? dotted_name # Optional namespace prefix (e.g., jac:module)
entry : "with" "entry" (":" NAME)? body
test : "test" NAME body
impl : "impl" NAME "." NAME params body
visit_stmt : "visit" (":" expr ":")? expr ("else" block)? # Optional index selector
edge_ref : "[" (edge | node)? edge_op filter? "]"
expr : ... (standard expressions plus graph operators)
# Pattern matching
match_stmt : "match" expr "{" case_clause* "}"
case_clause : "case" pattern ":" stmt*
pattern : literal | capture | sequence | mapping | class | as | or | star

# Wrong - missing semicolons
# x = 5
# print(x)
# Correct
with entry {
x = 5;
print(x);
}
# Wrong (Python style) - won't parse
# if condition:
# do_something()
# Correct
def do_something() -> None {
print("done");
}
with entry {
condition = True;
if condition {
do_something();
}
}
# Wrong - missing type annotations
# def add(a, b) {
# return a + b;
# }
# Correct
def add(a: int, b: int) -> int {
return a + b;
}
obj Example {
has field: int = 0; # Instance variable (with 'has')
def method() {
local = 5; # Local variable (no 'has')
self.field = local;
}
}
walker Example {
can traverse with Node entry {
print("Visiting");
visit [-->]; # Nodes queued, visited AFTER this method
print("This prints before visiting children");
}
}
walker Example {
can collect with Node entry {
report here.value; # Continues execution
visit [-->]; # Still runs
return here.value; # Would stop here
}
}

7. Global Modification Requires Declaration

Section titled “7. Global Modification Requires Declaration”
glob counter: int = 0;
def increment -> None {
global counter; # Required!
counter += 1;
}

Python:

class Person:
def __init__(self, name: str, age: int):
self.name = name
self.age = age
def greet(self) -> str:
return f"Hi, I'm {self.name}"

Jac:

obj Person {
has name: str;
has age: int;
def greet() -> str {
return f"Hi, I'm {self.name}";
}
}
with entry {
p = Person(name="Alice", age=30);
}

Python:

def add(a: int, b: int) -> int:
return a + b

Jac:

def add(a: int, b: int) -> int {
return a + b;
}

Python:

if x > 0:
print("positive")
elif x < 0:
print("negative")
else:
print("zero")

Jac:

with entry {
x = 1;
if x > 0 {
print("positive");
} elif x < 0 {
print("negative");
} else {
print("zero");
}
}

ProviderModel NamesEnvironment Variable
OpenAIgpt-4, gpt-4o, gpt-3.5-turboOPENAI_API_KEY
Anthropicclaude-3-opus, claude-3-sonnetANTHROPIC_API_KEY
Googlegemini-pro, gemini-ultraGOOGLE_API_KEY
Azureazure/gpt-4Azure config
Ollamaollama/llama2, ollama/mistralLocal (no key)

Model Name Format:

provider/model-name
Examples:
- gpt-4 (OpenAI, default provider)
- anthropic/claude-3-opus
- azure/gpt-4
- ollama/llama2

Jac Language Reference

Version: 3.1 Last Updated: January 2026

Validation Status: Validated against the Jac recursive descent parser (jaclang 0.10.0)

Resources: