This file contains hidden or 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
/* | |
cc === "current continuation" | |
*/ | |
bar: { | |
foo() | |
} | |
foo: { |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#define NOINLINE __attribute__((noinline)) | |
const size_t CONTINUATION_STACK_SIZE = 8192; |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#define NOINLINE __attribute__((noinline)) | |
typedef unsigned char byte; | |
typedef struct Continuation { |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
typedef unsigned char byte; | |
typedef struct Continuation { | |
void* rip; | |
void* rsp; |
This file contains hidden or 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
/* | |
My very own setjmp. | |
*/ | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
typedef struct Continuation { | |
void* rip; |
This file contains hidden or 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
foo: [a, b] { | |
a + b | |
} | |
foo(2, 3) // => 5 | |
ast: foo.ast.copy() | |
ast_addition: ast.children(0) | |
ast_call: ast_addition.children(0) | |
ast_call_target: ast_call.caller |
This file contains hidden or 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
/* simplified; no UNLESS. */ | |
conditional: IF expression EOL body EOL post_conditional { $$ = snow_ast_if_else($2, $4, $6); } | |
post_conditional: END | |
| ELSEIF expression EOL body EOL post_conditional { $$ = snow_ast_if_else($2, $4, $6); } | |
| ELSE body EOL { $$ = $2; } |
This file contains hidden or 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
func parse_function(input) | |
{ | |
return_type = parse_type(input) | |
name = parse_name_token(input) | |
parameters = parse_parameter_list(input) | |
body = parse_scope(input) | |
return new Function(return_type, name, parameters, body) | |
} |
This file contains hidden or 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
#include <stdio.h> | |
struct A { A() { printf("A()\n"); } ~A() { printf("~A()\n"); } }; | |
struct B { B() { printf("B()\n"); } ~B() { printf("~B()\n"); } }; | |
void foo(void* lbl) | |
{ | |
goto *lbl; | |
} |
This file contains hidden or 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
void foo() | |
{ | |
A a; | |
goto out; | |
B b; | |
out: | |
return; | |
} |