mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 21:35:03 +00:00
26 lines
598 B
PHP
26 lines
598 B
PHP
<?php
|
|
require('vendor/autoload.php');
|
|
|
|
function ml_get_lisp(): array
|
|
{
|
|
$tokenizer = new MadLisp\Tokenizer();
|
|
$reader = new MadLisp\Reader();
|
|
$eval = new MadLisp\Evaller();
|
|
$printer = new MadLisp\Printer();
|
|
|
|
$lisp = new MadLisp\Lisp($tokenizer, $reader, $eval, $printer);
|
|
|
|
// Environment
|
|
$env = new MadLisp\Env();
|
|
|
|
// Register core functions
|
|
$lisp->register($env);
|
|
|
|
// Register libraries
|
|
(new MadLisp\Lib\Math())->register($env);
|
|
(new MadLisp\Lib\Compare())->register($env);
|
|
(new MadLisp\Lib\Types())->register($env);
|
|
|
|
return [$lisp, $env];
|
|
}
|