1, 2, 3 de étape 1
This commit is contained in:
parent
d73a8e5c4b
commit
4debd0c1e5
4 changed files with 54 additions and 0 deletions
3
flap/questions/retrolixToX86_64/01.retrolix
Normal file
3
flap/questions/retrolixToX86_64/01.retrolix
Normal file
|
@ -0,0 +1,3 @@
|
|||
globals ()
|
||||
exit;
|
||||
end
|
26
flap/questions/retrolixToX86_64/02.retrolix
Normal file
26
flap/questions/retrolixToX86_64/02.retrolix
Normal file
|
@ -0,0 +1,26 @@
|
|||
globals (x, y, z, k)
|
||||
x <- copy 6;
|
||||
%rdi <- copy x;
|
||||
print_int();
|
||||
%rdi <- copy "\n";
|
||||
print_string();
|
||||
|
||||
y <- copy 7;
|
||||
%rdi <- copy y;
|
||||
print_int();
|
||||
%rdi <- copy "\n";
|
||||
print_string();
|
||||
|
||||
z <- mul y, x;
|
||||
%rdi <- copy z;
|
||||
print_int();
|
||||
%rdi <- copy "\n";
|
||||
print_string();
|
||||
|
||||
k <- sub z, x;
|
||||
%rdi <- copy k;
|
||||
print_int();
|
||||
%rdi <- copy "\n";
|
||||
print_string();
|
||||
|
||||
end
|
16
flap/questions/retrolixToX86_64/03.retrolix
Normal file
16
flap/questions/retrolixToX86_64/03.retrolix
Normal file
|
@ -0,0 +1,16 @@
|
|||
def fact ()
|
||||
%rax <- copy 1;
|
||||
boucle: jumpif lte %rdi, 1 -> fin, suite;
|
||||
suite: %rax <- mul %rax, %rdi;
|
||||
%rdi <- sub %rdi, 1;
|
||||
jump boucle;
|
||||
fin: ret;
|
||||
end
|
||||
|
||||
globals (res)
|
||||
%rdi <- copy 5;
|
||||
fact();
|
||||
res <- copy %rax;
|
||||
%rdi <- copy res;
|
||||
print_int();
|
||||
end
|
9
flap/questions/retrolixToX86_64/Makefile
Normal file
9
flap/questions/retrolixToX86_64/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FLAP = ../../_build/default/src/flap.exe
|
||||
TARGET = retrolix
|
||||
|
||||
main:
|
||||
@for f in $(wildcard *.$(TARGET)); do \
|
||||
printf "%s:\n" $$f; \
|
||||
./$(FLAP) -s $(TARGET) -d true -r true $$f; \
|
||||
printf "\n"; \
|
||||
done
|
Reference in a new issue