-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete compiler/print.jou and move its contents elsewhere (#589)
- Loading branch information
Showing
6 changed files
with
70 additions
and
78 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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import "stdlib/io.jou" | ||
|
||
|
||
def print_string(s: byte*, len: long) -> None: | ||
putchar('"') | ||
for i = 0; i < len; i++: | ||
if 32 <= s[i] and s[i] <= 126: | ||
# printable ascii character | ||
putchar(s[i]) | ||
elif s[i] == '\n': | ||
printf("\\n") | ||
else: | ||
printf("\\x%02x", s[i]) # TODO: \x is not yet recognized by the tokenizer | ||
putchar('"') |