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
function Query_Execute() { | |
/* Call ExecutionPlan_Execute on a different thread | |
* and wait for it to exit */ | |
char *error = NULL; | |
pthread_t thread; | |
pthread_create(&thread, NULL, ExecutionPlan_Execute, NULL); | |
pthread_join(thread, &error); | |
if(error != NULL) { | |
// Exception been thrown. |
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
function A() { | |
jump there; // Can't jump outside of current scope. | |
} | |
function B() { | |
there: | |
... | |
} |
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
try { | |
// Perform work which might throw an exception | |
work(); | |
} catch (error *e) { | |
reportError(e); | |
} |
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
if(cond) { | |
raise Exception("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
uint64_t dictStringHash(const void *key) { | |
return dictGenHashFunction(key, strlen(key)); | |
} | |
void *dictStringDup(void *privdata, const void *key) { | |
DICT_NOTUSED(privdata); | |
size_t key_len = strlen(key); | |
char *copy = malloc((key_len + 1) * sizeof(char)); | |
strcpy(copy, key); | |
copy[key_len] = 0; |
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
// (exp) | |
arithmetic_expression ::= LEFT_PARENTHESIS arithmetic_expression RIGHT_PARENTHESIS. | |
// exp + exp | |
arithmetic_expression ::= arithmetic_expression binary_operator arithmetic_expression. | |
// func(exp) | |
arithmetic_expression ::= STRING LEFT_PARENTHESIS arithmetic_expression_list RIGHT_PARENTHESIS. | |
// 9 | |
arithmetic_expression ::= value. | |
// friend.age | |
arithmetic_expression ::= variable. |
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
Evaluate(root) { | |
if(node_is_const(root)) { | |
return root.value; | |
} | |
for(child in root) { | |
evaluate(child); | |
} | |
return root.op(root.children); |
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
exp: exp op exp | |
exp: '(' exp ')' | |
exp: number | |
op: + | |
- | |
* | |
/ |
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
exp: exp op exp | |
exp: '(' exp ')' | |
exp: number | |
op: + | |
- | |
* | |
/ |
NewerOlder