Well, we have a REPL. It blows up horribly, but we have one.

This commit is contained in:
Simon Brooke 2026-04-17 14:20:31 +01:00
parent 4efe9eab87
commit cf05e30540
19 changed files with 422 additions and 144 deletions

View file

@ -20,10 +20,12 @@
#include "debug.h"
#include "psse.h"
#include "io/io.h"
#include "memory/node.h"
#include "memory/pso.h"
#include "memory/tags.h"
#include "ops/repl.h"
#include "ops/stack_ops.h"
#include "ops/truth.h"
@ -65,37 +67,8 @@ void print_options( FILE *stream ) {
#endif
}
/**
* @brief Handle an interrupt signal.
*
* @param dummy
*/
void int_handler( int dummy ) {
wprintf( L"TODO: handle ctrl-C in a more interesting way\n" );
}
/**
* The read/eval/print loop.
*/
void repl( ) {
signal( SIGINT, int_handler );
debug_print( L"Entered repl\n", DEBUG_REPL, 0 );
struct pso_pointer env = consp( oblist ) ? oblist : c_cons( oblist, nil );
/* bottom of stack */
struct pso_pointer frame_pointer = make_frame( 1, nil, nil, env );
if ( !nilp( frame_pointer ) ) {
// lisp_repl( get_stack_frame( frame_pointer ), frame_pointer, env );
dec_ref( frame_pointer );
}
debug_print( L"Leaving repl\n", DEBUG_REPL, 0 );
}
/**
* main entry point; parse command line arguments, initialise the environment,
* and enter the read-eval-print loop.
*/
@ -150,7 +123,8 @@ int main( int argc, char *argv[] ) {
fputs( "Failed to initialise node\n", stderr );
exit( 1 );
}
// repl( );
c_repl( );
exit( 0 );
}