diff options
| author | Baitinq <[email protected]> | 2025-04-06 16:17:22 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-04-06 16:17:22 +0200 |
| commit | bd42f4899d09c8f6317ae1af1747ae5b6ac81650 (patch) | |
| tree | ed21afbbcca7f0be0751e4bf7104bf7cdc9f36e6 /examples | |
| parent | Codegen: Fix GEP type (diff) | |
| download | pry-lang-bd42f4899d09c8f6317ae1af1747ae5b6ac81650.tar.gz pry-lang-bd42f4899d09c8f6317ae1af1747ae5b6ac81650.tar.bz2 pry-lang-bd42f4899d09c8f6317ae1af1747ae5b6ac81650.zip | |
Feature: Add char type and support underlying pointer values
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/19.src | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/19.src b/examples/19.src new file mode 100644 index 0000000..2aa5dd7 --- /dev/null +++ b/examples/19.src @@ -0,0 +1,23 @@ +extern printf = (*i64, varargs) => void; +extern malloc = (i64) => *i8; +extern free = (*i64) => void; + +let main = () => i64 { + let buf = malloc(13); + (*(buf+0)) = 'h'; + (*(buf+1)) = 'e'; + (*(buf+2)) = 'l'; + (*(buf+3)) = 'l'; + (*(buf+4)) = 'o'; + (*(buf+5)) = ' '; + (*(buf+6)) = 'w'; + (*(buf+7)) = 'o'; + (*(buf+8)) = 'r'; + (*(buf+9)) = 'l'; + (*(buf+10)) = 'd'; + (*(buf+11)) = '\n'; + (*(buf+12)) = '\0'; + printf("%s", buf); + free(buf); + return 0; +}; |