Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/Samples/Kaleidoscope/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ vsspell_section_id = 1566b770c5af48b08aa5b43b10ffef28
vsspell_ignored_words_1566b770c5af48b08aa5b43b10ffef28 = File:IgnoredWords.dic|def

[*.kls]
# VSSPELL: DIsable everything for the sample languages
# VSSPELL: Disable everything for the sample languages
vsspell_section_id = 257c51e4a39d462090397bebd5922176
vsspell_spell_check_as_you_type = false
vsspell_include_in_project_spell_check = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public KaleidoscopeUserOperatorListener( DynamicRuntimeState state )
/// <summary>Handles successfully parsed function definitions</summary>
/// <param name="context">Context parse node for the parsed function</param>
/// <remarks>
/// Upon successful parse of a function definition this check if it is a user defined operator
/// and updates the RuntimeState accordingly, if it is.
/// Upon successful parse of a function definition this checks if it is a user defined operator
/// and updates the RuntimeState accordingly, if it is. This is used for support of user defined
/// operators providing user defined precedence.
/// </remarks>
public override void ExitFunctionDefinition( KaleidoscopeParser.FunctionDefinitionContext context )
{
Expand Down
8 changes: 8 additions & 0 deletions src/Samples/Kaleidoscope/mandel.kls
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# unary operator to perform a logical NOT
def unary!(v)
if v then
0
else
1;

# unary operator to perform a mathematical negation
def unary-(v)
0-v;

# Comparison operator
def binary> 10 (LHS RHS)
RHS < LHS;

# Logical OR operator
def binary| 5 (LHS RHS)
if LHS then
1
Expand All @@ -18,17 +22,21 @@ def binary| 5 (LHS RHS)
else
0;

# Logical AND operator
def binary& 6 (LHS RHS)
if !LHS then
0
else
!!RHS;

# arithmatic equality test
def binary== 9 (LHS RHS)
!(LHS < RHS | LHS > RHS);

# selector operator
def binary : 1 (x y) y;

# declare access to built-in function
extern putchard(char);

def printdensity(d)
Expand Down
Loading