소스 검색

Modify drafts and tests

master
mtardy 4 년 전
부모
커밋
319f05ff1c
3개의 변경된 파일30개의 추가작업 그리고 17개의 파일을 삭제
  1. +12
    -10
      drafts/c.c
  2. +10
    -7
      test2.txt
  3. +8
    -0
      test3.txt

+ 12
- 10
drafts/c.c 파일 보기

@ -17,25 +17,27 @@ struct jb_record
struct jb_record *jbs= 0;
int eval(oop ast)
{
case t_call: {
pushJbRec();
if (0 != set_jmp(jbs->jb)) {
oop result = jbs->result;
popJbRec();
return result;
}
// run the body of the function here
result = (each statement in the func body...);
popJbRec();
return result;
pushJbRec();
if (0 != set_jmp(jbs->jb)) {
oop result = jbs->result;
popJbRec();
return result;
}
// run the body of the function here
result = (each statement in the func body...);
popJbRec();
return result;
}
setjmp(jb);
if (n < 2) return 1;
return 1 + f(n-1) + f(n-2);
}
int main()
{
printf("%zi\n", sizeof(jmp_buf));

+ 10
- 7
test2.txt 파일 보기

@ -1,13 +1,16 @@
fun f() {
var i = 0
while (i<10) {
print(i)
if (i == 5) {
return 42
}
else {
i = i + 1
for (var i= 0; i < 10; i = i + 1) {
switch (i) {
case 5: {
continue
}
case 8: {
return 66;
}
}
print(i)
}
24 + 2
}
f()

+ 8
- 0
test3.txt 파일 보기

@ -0,0 +1,8 @@
fun f(n) {
if (n < 2) {
return 1
} else {
return 1 + f(n-1) + f(n-2)
}
}
f(27)

불러오는 중...
취소
저장