-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LLVM: Support function call expressions (complete expression support)
- Loading branch information
Showing
4 changed files
with
169 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// CASE Basic function call | ||
// RETURNS 1 | ||
|
||
int f(int x) { | ||
return x - 1; | ||
} | ||
|
||
int main() { | ||
return f(2); | ||
} | ||
|
||
// CASE Recursive Fibonacci | ||
// RETURNS 3 | ||
|
||
int fib(int n) { | ||
if (n <= 1) return n; | ||
return fib(n-1) + fib(n-2); | ||
} | ||
|
||
int main() { | ||
return fib(4); | ||
} | ||
|
||
// CASE Print to stdout | ||
// RETURNS 0 | ||
// Outputs Hello | ||
|
||
int putchar(int c); | ||
|
||
int main() { | ||
putchar(72); | ||
putchar(101); | ||
putchar(108); | ||
putchar(108); | ||
putchar(111); | ||
return 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
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