Created
June 2, 2010 12:23
-
-
Save dom96/422296 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2010 (C) Dominik Picheta - Read license.txt for the license. | |
# 30 May 2010 | |
# REPL - A nice REPL for nael. | |
import interpreter, os | |
when isMainModule: | |
if paramCount() == 0: | |
var dataStack = newStack(200) | |
var vars = newVariables() # 'main' variables(They act as both local and global) | |
vars.addStandard() | |
while True: | |
stdout.write(">> ") | |
try: | |
exec(stdin.readLine(), dataStack, vars, vars) | |
except ERuntimeError, EOverflow, EInvalidValue: | |
echo(getCurrentExceptionMsg()) | |
printStack(dataStack) | |
else: | |
if paramStr(1) == "-a" or paramStr(1) == "--about": | |
echo(" nael interpreter v0.1") | |
echo(" ---------------------") | |
echo("http://github.com/dom96/nael") | |
echo("For license read license.txt") | |
var dataStack = newStack(200) | |
var vars = newVariables() # 'main' variables(They act as both local and global) | |
vars.addStandard() | |
exec("5 print", dataStack, vars, vars) | |
elif paramStr(1) == "-h" or paramStr(1) == "--help" or paramCount() > 0: | |
echo("nael Interpreter") | |
echo("nael -h[--help] This help message") | |
echo("nael -a[--about] About") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment