Skip to content

Instantly share code, notes, and snippets.

@dom96
Created June 2, 2010 12:23
Show Gist options
  • Save dom96/422296 to your computer and use it in GitHub Desktop.
Save dom96/422296 to your computer and use it in GitHub Desktop.
# 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