- Timestamp:
- 05/04/08 10:19:58 (7 months ago)
- Location:
- lang/c/misc/mlisp
- Files:
-
- 7 modified
-
readme.txt (modified) (1 diff)
-
sexp/inner.h (modified) (2 diffs)
-
sexp/sexp.cpp (modified) (4 diffs)
-
sexp/sexp.h (modified) (2 diffs)
-
sexp/sread.cpp (modified) (14 diffs)
-
test/main.cpp (modified) (1 diff)
-
test/vm.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/misc/mlisp/readme.txt
r11058 r11059 6 6 7 7 8 * �m�[�g 9 -repl ����quit�v�Ƒł����ނƔ�����-�V���{���̑啶���Ə�������ʂ��� 10 11 12 * ��� 8 13 -BoehmGC ��p 14 -�r������p�C�����āA�o�C�g�R�[�h��s 9 15 -�q�[�v�x�[�X�̎�� 10 -repl ����quit�v�Ƒł����ނƔ�����-�unil�v�ut�v���V���{���Ȃ̂ŁA�R���p�C�������V���{���Q�ƂɂȂ�Ă��܂� 11 -�V���{���̑啶���Ə�������ʂ��� 16 17 18 19 * ToDo 20 - �X�^�b�N�x�[�X�ɒu��������- �R���p�C�����̊��Ăяo���`�F�b�N 21 -- �����H 22 -- ����������Ă邩�H 23 - �C�ӌ̈��� 24 - �}�N����� 25 - C �������[�o���̊���яo�������ɂ���-�unil�v�ut�v���V���{���Ȃ̂ŁA�R���p�C�������V���{���Q�ƂɂȂ�Ă��܂� 26 27 - SDL �Ɨ��߂ĂȂ��i�e�g���X�j 28 -
lang/c/misc/mlisp/sexp/inner.h
r11057 r11059 5 5 6 6 #include "sexp.h" 7 #include <assert.h>8 7 9 8 #ifndef FALSE … … 87 86 }; 88 87 89 90 // ��truct Stream {91 virtual int getch(void) = 0;92 virtual void ungetch(int c) = 0;93 };94 -
lang/c/misc/mlisp/sexp/sexp.cpp
r11058 r11059 70 70 }; 71 71 72 static void init_const( ) {72 static void init_const(void) { 73 73 symNil.type = tSymb; 74 74 strcpy(symNil.str, "nil"); … … 139 139 140 140 141 static void close( ) {141 static void close(void) { 142 142 symbol_table.clear(); 143 143 } … … 169 169 } 170 170 171 void reset_error( ) {171 void reset_error(void) { 172 172 } 173 173 … … 287 287 } 288 288 289 void mlisp_delete( ) {289 void mlisp_delete(void) { 290 290 close(); 291 291 } -
lang/c/misc/mlisp/sexp/sexp.h
r11058 r11059 78 78 79 79 /// ���� 80 void mlisp_delete( );80 void mlisp_delete(void); 81 81 82 82 // Lisp�n�� … … 100 100 101 101 void error(int errid, ...); 102 void reset_error( );102 void reset_error(void); 103 103 104 104 SExp list(int n, ...); -
lang/c/misc/mlisp/sexp/sread.cpp
r11057 r11059 25 25 26 26 27 28 // ��g���[�� 29 struct Stream { 30 virtual int getch(void) = 0; 31 virtual void ungetch(int c) = 0; 32 }; 33 34 27 35 inline SExp sexp(int x) { SExp s; s.i = x; return s; } 28 36 … … 31 39 32 40 /// �ǂݔ�� 33 static int skip_space(Stream* strm) 34 { 41 static int skip_space(Stream* strm) { 35 42 for (;;) { 36 43 int c = strm->getch(); … … 42 49 43 50 /// ��œǂݔ�� 44 static void skip_line_comment(Stream* strm) 45 { 51 static void skip_line_comment(Stream* strm) { 46 52 for (;;) { 47 53 int c = strm->getch(); … … 51 57 52 58 /// #|...|# ��ݔ�� 53 static void skip_block_comment(Stream* strm) 54 { 59 static void skip_block_comment(Stream* strm) { 55 60 for (;;) { 56 61 int c = strm->getch(); … … 66 71 67 72 /// �\��H 68 static SExp reserved(const char* symb, const char* end) 69 { 73 static SExp reserved(const char* symb, const char* end) { 70 74 struct { 71 75 const char* str; … … 88 92 89 93 /// �������l���e����������琔�l��� 90 SExp make_number(const char* str) 91 { 94 /** 95 @return nil �Ȃ琔�l��������� 96 */ 97 static SExp make_number(const char* str) { 92 98 const char* p = str; 93 99 int flag = +1; … … 111 117 /** 112 118 "..." ��ݍ��������Ԃ� 113 */ 114 SExp read_string(Stream* strm) 115 { 119 �����������*/ 120 static SExp read_string(Stream* strm) { 116 121 char str[256]; 117 122 char* end = str + sizeof(str) - 1; … … 126 131 c = strm->getch(); 127 132 switch (c) { 128 default: break; 133 default: // ���̑��F�Ȃɂ��� 134 *q++ = '\\'; 135 break; 129 136 case 't': c = '\t'; break; 130 137 case 'n': c = '\n'; break; 131 138 case '0': c = '\0'; break; 132 case '\n': continue; 139 case '\n': continue; // �s�p�� 133 140 } 134 141 } … … 147 154 (...) ��ݍ�����X�g��� 148 155 */ 149 static SExp read_list(Stream* fp) 150 { 156 static SExp read_list(Stream* fp) { 151 157 SExp s; 152 158 SExp top = nil, tail = nil; … … 200 206 �ǂݍ��݂̐擪 201 207 */ 202 static SExp read_rec(Stream* strm) 203 { 208 static SExp read_rec(Stream* strm) { 204 209 int c; 205 210 … … 309 314 310 315 311 312 static SExp read(Stream* strm) 313 { 316 static SExp read(Stream* strm) { 314 317 SExp s = read_rec(strm); 315 318 if (s.i == cFail) { … … 324 327 325 328 326 327 // =============================================================================329 //============================================================================= 330 // �t�@�C�������ǂݍ��� 328 331 329 332 struct FileStream : public Stream { … … 336 339 }; 337 340 338 SExp read_from_file(FILE* fp) 339 { 340 FileStream strm(fp); 341 return read(&strm); 342 } 343 344 345 //============================================================================= 341 342 //============================================================================= 343 // �������ǂݍ��� 346 344 347 345 struct StrStream : public Stream { … … 373 371 }; 374 372 375 SExp read_from_string(const char* str) 376 { 373 374 //============================================================================= 375 376 SExp read_from_file(FILE* fp) { 377 FileStream strm(fp); 378 return read(&strm); 379 } 380 381 SExp read_from_string(const char* str) { 377 382 StrStream strm(str); 378 383 return read(&strm); -
lang/c/misc/mlisp/test/main.cpp
r11058 r11059 291 291 SExp code = nil; 292 292 if (fp != NULL) { 293 // runtime_error(); 294 } else { 293 295 SExp acc = nil; 294 296 for (;;) { -
lang/c/misc/mlisp/test/vm.cpp
r11058 r11059 1 1 //============================================================================= 2 /// heap-base 2 /// �o�[�`�����}�V�� 3 /** 4 heap-base 5 */ 3 6 //============================================================================= 4 7 … … 10 13 #include <assert.h> 11 14 15 12 16 static void runtime_error(const char* msg) { 13 17 assert(!msg); 14 18 } 15 16 19 17 20
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)