Initial state - basic lexer + parser + interpreter
This commit is contained in:
		
							
								
								
									
										6
									
								
								bin/dune
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								bin/dune
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
(executable
 | 
			
		||||
 (name main)
 | 
			
		||||
 (public_name main)
 | 
			
		||||
 (libraries str lisp unix))
 | 
			
		||||
(include_subdirs unqualified)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										17
									
								
								bin/main.ml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								bin/main.ml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
open Lisp.Ast;;
 | 
			
		||||
open Printf;;
 | 
			
		||||
open Lisp;;
 | 
			
		||||
open Eval;;
 | 
			
		||||
open Read;;
 | 
			
		||||
let rec repl c =
 | 
			
		||||
  let () = printf ">>> "; Out_channel.flush Out_channel.stdout; in
 | 
			
		||||
  match In_channel.input_line c with
 | 
			
		||||
  | None -> ()
 | 
			
		||||
  | Some l -> 
 | 
			
		||||
    let vals = (parse_str l) in
 | 
			
		||||
    (* dbg_print_all vals; *)
 | 
			
		||||
    dbg_print_all (eval_all vals);
 | 
			
		||||
    Out_channel.flush Out_channel.stdout;
 | 
			
		||||
    repl c;;
 | 
			
		||||
 | 
			
		||||
let _ = repl (In_channel.stdin)
 | 
			
		||||
		Reference in New Issue
	
	Block a user