- Timestamp:
- 05/04/08 21:45:54 (7 months ago)
- Location:
- lang/c/misc/mlisp
- Files:
-
- 3 modified
-
compiler/compiler.cpp (modified) (9 diffs)
-
readme.txt (modified) (1 diff)
-
vm/op.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/misc/mlisp/compiler/compiler.cpp
r11061 r11110 10 10 11 11 12 void compile_error(int errcode) { 13 error(errcode); 14 } 15 16 17 12 18 static SExp extend(SExp e, SExp r) { 13 19 return cons(r, e); … … 18 24 } 19 25 20 21 void compile_error(int errcode) { 22 error(errcode); 23 } 24 25 // ���݂̊��ɕϐ���^ 26 // �߂��̓C���f�N�X 27 SExp compile_define_var(SExp env, SExp var) { 26 /// ���ɕϐ���^ 27 /** 28 @return �C���f�N�X 29 */ 30 static SExp compile_define_var(SExp env, SExp var) { 28 31 SExp e = car(env); 29 32 int l; … … 38 41 } 39 42 40 // ���[�J�����ɕϐ���^41 SExp compile_define_local(SExp env, SExp var) {43 /// ���[�J�����ɕϐ���^ 44 static SExp compile_define_local(SExp env, SExp var) { 42 45 return cons(int2s(0), compile_define_var(env, var)); 43 46 } 44 47 45 // ���[�J�����ɕϐ���^46 SExp compile_define_global(SExp env, SExp var) {48 /// ���[�J�����ɕϐ���^ 49 static SExp compile_define_global(SExp env, SExp var) { 47 50 return cons(int2s(length(env) - 1), compile_define_var(last_pair(env), var)); 48 51 } 49 52 50 53 51 52 54 /// �ϐ��Q�� 53 55 static SExp compile_lookup(SExp var, SExp e) { 54 #if 055 int rib = 0;56 nxtrib:;57 if (nilp(e)) return nil;58 SExp vars = car(e);59 int elt = 0;60 nxtelt:;61 if (nilp(vars)) { e = cdr(e); ++rib; goto nxtrib; }62 if (eq(car(vars), var)) return cons(int2s(rib), int2s(elt));63 else { vars = cdr(vars); ++elt; goto nxtelt; }64 #else65 56 int rib = 0; 66 57 for (;; e = cdr(e), ++rib) { … … 73 64 } 74 65 } 75 #endif76 66 } 77 67 78 68 /// �y�A����p�C�� 79 69 static SExp compile_pair_loop(SExp args, SExp c, SExp e, SExp next) { 80 70 if (nilp(args)) { … … 89 79 } 90 80 91 SExp compile_set(SExp op, SExp sym, SExp val, SExp e, SExp next, bool b_define) { 81 /// set! ����p�C�� 82 static SExp compile_set(SExp op, SExp sym, SExp val, SExp e, SExp next, bool b_define) { 92 83 SExp access = compile_lookup(sym, e); 93 84 if (nilp(access)) { … … 101 92 } 102 93 103 SExp compile_define(SExp var, SExp xs, SExp e, SExp next) { 94 /// define ����p�C�� 95 static SExp compile_define(SExp var, SExp xs, SExp e, SExp next) { 104 96 while (consp(var)) { 105 97 SExp fname = car(var); … … 112 104 } 113 105 114 SExp get_next(SExp sexps, SExp next) { 106 /// �u���b�N�R���p�C�����́A���̖��� 107 static SExp get_next(SExp sexps, SExp next) { 115 108 if (singlep(sexps)) 116 109 return cons(car(next), cdr(next)); … … 119 112 } 120 113 121 SExp compile_block_loop(SExp sexps, SExp e, SExp prev, SExp next) { 122 while (!nilp(sexps)) { 114 /// �����̎�����p�C�� 115 SExp compile_block(SExp sexps, SExp e, SExp next) { 116 SExp start = get_next(sexps, next); 117 for (SExp prev = start; !nilp(sexps); sexps = cdr(sexps)) { 123 118 SExp se = car(sexps); 124 119 SExp nx = get_next(sexps, next); … … 127 122 rplacd(prev, cdr(r)); 128 123 129 sexps = cdr(sexps);130 124 prev = nx; 131 125 } 132 return prev;133 }134 135 136 SExp compile_block(SExp sexps, SExp e, SExp next) {137 SExp start = get_next(sexps, next);138 compile_block_loop(sexps, e, start, next);139 126 return start; 140 127 } 141 128 142 129 /// �P�̎�����p�C�� 143 130 SExp compile(SExp x, SExp e, SExp next) { 144 131 if (symbolp(x)) { -
lang/c/misc/mlisp/readme.txt
r11059 r11110 7 7 8 8 * �m�[�g 9 -repl ����quit�v�Ƒł����ނƔ�����-�V���{���̑啶���Ə�������ʂ��� 9 - repl ����quit�v�Ƒł����ނƔ�����- �V���{���̑啶���Ə�������ʂ��� 10 - ������ 11 -- ���� 12 -- �V���{�� 13 -- ������- �Z�� 10 14 11 15 12 16 * ��� 13 - BoehmGC ��p14 - �r������p�C�����āA�o�C�g�R�[�h��s15 - �q�[�v�x�[�X�̎��17 - �r������p�C�����āA�o�C�g�R�[�h��s 18 - �q�[�v�x�[�X�̎�� 19 - BoehmGC ��p 16 20 21 22 23 * �\�[�X�\�� 24 25 sexp 26 �r������ compiler 27 �R���p�C�� 28 vm 29 �o�[�`�����}�V�� 30 test 31 �e�X�g�p�G���g�� 32 33 mlisp.vcproj 34 VC(2003) �p�v���W�F�N�g�t�@�C�� 17 35 18 36 19 37 * ToDo 20 38 - �X�^�b�N�x�[�X�ɒu��������- �R���p�C�����̊��Ăяo���`�F�b�N 21 -- ����� H39 -- �����ǂ����H 22 40 -- ����������Ă邩�H 23 41 - �C�ӌ̈��� 24 42 - �}�N����� 25 - C �������[�o���̊���яo�������ɂ���-�unil�v�ut�v���V���{���Ȃ̂ŁA�R���p�C�������V���{���Q�ƂɂȂ�Ă��܂� 43 -- macroexpand ��- C �������[�o���̊���яo�������ɂ���- �unil�v�ut�v���V���{���Ȃ̂ŁA�R���p�C�������V���{���Q�ƂɂȂ�Ă��܂� 44 - ��s���ɕϐ�������������Ƃ��̎����� 45 - �������� 26 46 27 47 - SDL �Ɨ��߂ĂȂ��i�e�g���X�j 28 48 49 50 51 * changelog 52 53 ** 080504 54 - �쐬 -
lang/c/misc/mlisp/vm/op.h
r11061 r11110 1 //============================================================================= 2 /// �o�C�g�R�[�h�̖��ߒ� 3 //============================================================================= 4 1 5 #pragma once 2 6
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)