Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Males, Sebastian
wacc_examples
Commits
7e035431
Commit
7e035431
authored
Mar 19, 2021
by
540KJ
Browse files
[sm919][jlq19] Add tests for clojures
parent
b58a101a
Changes
6
Hide whitespace changes
Inline
Side-by-side
valid/
function/simple_
function
s
/sameArgName2.wacc
→
in
valid/
semanticErr/
function/sameArgName2.wacc
View file @
7e035431
File moved
valid/
function/simple_
function
s
/sameNameAsVar.wacc
→
in
valid/
semanticErr/
function/sameNameAsVar.wacc
View file @
7e035431
File moved
valid/function/closures/closureManyOutsideVars.wacc
0 → 100644
View file @
7e035431
# a simple closure with closure function taking in many closure variables
# Output:
# 23
# Exit:
# 0
# Program:
begin
int{int} f(int x, int a, int b, int c, int d) is
return (\(int y) -> d + x + y + a + b + c)
end
int{int} x = call f(2, 1, 3, 10, 4);
int y = call x(3);
println y
end
\ No newline at end of file
valid/function/closures/closureOnlyLambdas.wacc
0 → 100644
View file @
7e035431
# a simple closure with closure function that only uses lambdas
# Output:
# 208
# Exit:
# 0
# Program:
begin
int a1 = 2 ;
int{int, int} f1 = \(int c, int d) -> a1 + c + d ;
int{int, int} x = \(int a, int b) -> call f1 (2, 3) + a + b + a1 ;
int y = call x(100, 99) ;
println y
end
\ No newline at end of file
valid/function/closures/closureReturnFuncFromLambda.wacc
0 → 100644
View file @
7e035431
# a simple closure that uses a lambda to return a function pointer
# Output:
# 100
# Exit:
# 0
# Program:
begin
int g(int a) is
return a
end
int a1 = 2 ;
int{int}{int, int} f1 = \(int c, int d) -> g ;
int{int} x = call f1(a1, a1) ;
int y = call x(100) ;
println y
end
\ No newline at end of file
valid/function/nested_functions/fixedPointRealArithmetic.wacc
View file @
7e035431
...
...
@@ -28,9 +28,9 @@ begin
int f() is
int qq = call q() ;
# f = 2**q
int
f
= call power(2, qq) ;
return
f
# f = 2**q
;
int
g
= call power(2, qq) ;
return
g
end
# The implementation of the following functions are translated from the URI above.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment