SIGN IN SIGN UP
2016-08-20 15:09:19 -05:00
$ErrorActionPreference = "Stop"
Import-Module $PSScriptRoot/reader.psm1
Import-Module $PSScriptRoot/printer.psm1
# READ
2016-08-20 15:09:19 -05:00
function READ([String] $str) {
return read_str($str)
}
# EVAL
2016-08-20 15:09:19 -05:00
function EVAL($ast, $env) {
return $ast
}
# PRINT
2016-08-20 15:09:19 -05:00
function PRINT($exp) {
return pr_str $exp $true
}
# REPL
function REP([String] $str) {
2016-08-20 15:09:19 -05:00
return PRINT (EVAL (READ $str) @{})
}
while ($true) {
Write-Host "user> " -NoNewline
$line = [Console]::ReadLine()
if ($line -eq $null) {
break
}
try {
Write-Host (REP($line))
2016-08-20 15:09:19 -05:00
} catch {
Write-Host "Exception: $($_.Exception.Message)"
}
}