Work on the eval-quote bug. I have a really profound misunderstanding here!
But, in working on it, I've worked hard on documentation, which is good.
This commit is contained in:
		
							parent
							
								
									7f29c11592
								
							
						
					
					
						commit
						3112f190db
					
				|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * conspage.c |  * conspage.c | ||||||
|  * |  * | ||||||
|  * Setup and tear down cons pages, and (FOR NOW) do primitive  |  * Setup and tear down cons pages, and (FOR NOW) do primitive  | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  *  consspaceobject.c |  *  consspaceobject.c | ||||||
|  * |  * | ||||||
|  *  Structures common to all cons space objects. |  *  Structures common to all cons space objects. | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * equal.c |  * equal.c | ||||||
|  * |  * | ||||||
|  * Checks for shallow and deep equality |  * Checks for shallow and deep equality | ||||||
|  | @ -38,7 +38,7 @@ bool same_type( struct cons_pointer a, struct cons_pointer b ) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Some string will be null terminated and some will be NIL terminated... ooops! |  * Some strings will be null terminated and some will be NIL terminated... ooops! | ||||||
|  * @param string the string to test |  * @param string the string to test | ||||||
|  * @return true if it's the end of a string. |  * @return true if it's the end of a string. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * init.c |  * init.c | ||||||
|  * |  * | ||||||
|  * Start up and initialise the environement - just enough to get working  |  * Start up and initialise the environement - just enough to get working  | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * integer.c |  * integer.c | ||||||
|  * |  * | ||||||
|  * functions for integer cells. |  * functions for integer cells. | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * intern.c |  * intern.c | ||||||
|  * |  * | ||||||
|  * For now this implements an oblist and shallow binding; local environments can |  * For now this implements an oblist and shallow binding; local environments can | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * lispops.c |  * lispops.c | ||||||
|  * |  * | ||||||
|  * List processing operations. |  * List processing operations. | ||||||
|  | @ -199,6 +199,17 @@ lisp_eval( struct stack_frame *frame, struct cons_pointer env ) { | ||||||
|     switch ( cell.tag.value ) { |     switch ( cell.tag.value ) { | ||||||
|     case CONSTV: |     case CONSTV: | ||||||
|         result = c_apply( frame, env ); |         result = c_apply( frame, env ); | ||||||
|  | 	/* I have a profound misunderstanding of how quote and eval should interact!  
 | ||||||
|  | 	 * if ( equal( c_car(frame->arg[0]), c_string_to_lisp_symbol("quote")))  | ||||||
|  | 	 *   /\* car is QUOTE. TODO: It is ABSURDLY expensive to 'equal' each time! *\/  | ||||||
|  | 	 *        {  | ||||||
|  | 	 * 	 /\* we need to eval it again *\/  | ||||||
|  | 	 * 	 frame->arg[0] = result;  | ||||||
|  | 	 * 	 fputws( L"quote - re-evaling", stderr);  | ||||||
|  | 	 * 	 dump_frame( stderr, frame );  | ||||||
|  | 	 * 	 result = c_apply(frame, env);  | ||||||
|  | 	 *        } */ | ||||||
|  | 
 | ||||||
|         break; |         break; | ||||||
| 
 | 
 | ||||||
|     case SYMBOLTV: |     case SYMBOLTV: | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * peano.c |  * peano.c | ||||||
|  * |  * | ||||||
|  * Basic peano arithmetic |  * Basic peano arithmetic | ||||||
|  |  | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| /**
 | /*
 | ||||||
|  * print.c |  * print.c | ||||||
|  * |  * | ||||||
|  * First pass at a printer, for bootstrapping. |  * First pass at a printer, for bootstrapping. | ||||||
|  * |  * | ||||||
|  * |  | ||||||
|  * (c) 2017 Simon Brooke <simon@journeyman.cc> |  * (c) 2017 Simon Brooke <simon@journeyman.cc> | ||||||
|  * Licensed under GPL version 2.0, or, at your option, any later version. |  * Licensed under GPL version 2.0, or, at your option, any later version. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * read.c |  * read.c | ||||||
|  * |  * | ||||||
|  * First pass at a reader, for bootstrapping. |  * First pass at a reader, for bootstrapping. | ||||||
|  |  | ||||||
|  | @ -1,7 +1,10 @@ | ||||||
| /*
 | /*
 | ||||||
|  * To change this license header, choose License Headers in Project Properties. |  * real.c | ||||||
|  * To change this template file, choose Tools | Templates |  * | ||||||
|  * and open the template in the editor. |  * functions for real number cells. | ||||||
|  |  * | ||||||
|  |  * (c) 2017 Simon Brooke <simon@journeyman.cc> | ||||||
|  |  * Licensed under GPL version 2.0, or, at your option, any later version. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "conspage.h" | #include "conspage.h" | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/repl.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/repl.c
									
									
									
									
									
								
							|  | @ -1,8 +1,12 @@ | ||||||
| /*
 | /*
 | ||||||
|  * To change this license header, choose License Headers in Project Properties. |  * repl.c | ||||||
|  * To change this template file, choose Tools | Templates |  * | ||||||
|  * and open the template in the editor. |  * the read/eval/print loop | ||||||
|  |  * | ||||||
|  |  * (c) 2017 Simon Brooke <simon@journeyman.cc> | ||||||
|  |  * Licensed under GPL version 2.0, or, at your option, any later version. | ||||||
|  */ |  */ | ||||||
|  | 
 | ||||||
| #include <stdbool.h> | #include <stdbool.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <wchar.h> | #include <wchar.h> | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								src/stack.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/stack.c
									
									
									
									
									
								
							|  | @ -1,4 +1,4 @@ | ||||||
| /**
 | /*
 | ||||||
|  * stack.c |  * stack.c | ||||||
|  * |  * | ||||||
|  * The Lisp evaluation stack. |  * The Lisp evaluation stack. | ||||||
|  | @ -153,7 +153,14 @@ void free_stack_frame( struct stack_frame *frame ) { | ||||||
| void dump_frame( FILE * output, struct stack_frame *frame ) { | void dump_frame( FILE * output, struct stack_frame *frame ) { | ||||||
|     fputws( L"Dumping stack frame\n", output ); |     fputws( L"Dumping stack frame\n", output ); | ||||||
|     for ( int arg = 0; arg < args_in_frame; arg++ ) { |     for ( int arg = 0; arg < args_in_frame; arg++ ) { | ||||||
|         fwprintf( output, L"Arg %d:", arg ); |           struct cons_space_object cell = pointer2cell( frame->arg[arg] ); | ||||||
|  | 
 | ||||||
|  | 	  fwprintf( output, L"Arg %d:\t%c%c%c%c\t", arg, | ||||||
|  |               cell.tag.bytes[0], | ||||||
|  |               cell.tag.bytes[1], | ||||||
|  |               cell.tag.bytes[2], | ||||||
|  | 	      cell.tag.bytes[3]); | ||||||
|  | 
 | ||||||
|         print( output, frame->arg[arg] ); |         print( output, frame->arg[arg] ); | ||||||
|         fputws( L"\n", output ); |         fputws( L"\n", output ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue