new env for user definitions

This commit is contained in:
Pekka Laiho 2020-06-04 16:46:23 +07:00
parent cf9af2b5fe
commit 90654396b9

View File

@ -1,13 +1,16 @@
<?php <?php
require('bootstrap.php'); require('bootstrap.php');
list($lisp, $env) = ml_get_lisp(); list($lisp, $rootEnv) = ml_get_lisp();
// Create new env for user definitions
$userEnv = new MadLisp\Env($rootEnv);
while (true) { while (true) {
$input = readline('> '); $input = readline('> ');
try { try {
$lisp->rep($input, $env); $lisp->rep($input, $userEnv);
} catch (MadLisp\MadLispException $ex) { } catch (MadLisp\MadLispException $ex) {
print('error: ' . $ex->getMessage()); print('error: ' . $ex->getMessage());
} catch (TypeError $ex) { } catch (TypeError $ex) {