Skip to content

Commit

Permalink
Add examples for planned features
Browse files Browse the repository at this point in the history
  • Loading branch information
Cypher1 committed Apr 20, 2024
1 parent ce6526c commit 69dddf3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/contexts.tk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
test = {
allocator = import("allocator")
ptr = allocator.allocate(sizeof(char[100]))
if (ptr == nullptr) {
print("Success")
exit(0)
} else {
print("Failure")
}
}

main = {
allocator = import("allocator")
logger = import("logger")

test_logger = logger.new_logger()
with {
allocator.allocate = allocator.reportOom,
system.out = test_logger,
system.error = test_logger,
run = test
}

print(test_logger)
}
25 changes: 25 additions & 0 deletions examples/enums.tk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
boolean = Enum.new(
true=1,
false=0,
)

boolean.importLiterals()

color = Enum
.basedOn(
byte[3]
)
.open(
red=#ff0000,
green=#00ff00,
blue=#0000ff,
)

color.addValues(
purple=#ff00ff,
cyan=#00ffff,
)

main = {
print("Color {red} is red")
}
File renamed without changes.
File renamed without changes.

0 comments on commit 69dddf3

Please sign in to comment.