Skip to content

Instantly share code, notes, and snippets.

@pdonorio
Created May 16, 2017 08:26
Show Gist options
  • Save pdonorio/27b6a78947dbae340d485b491aa82d2d to your computer and use it in GitHub Desktop.
Save pdonorio/27b6a78947dbae340d485b491aa82d2d to your computer and use it in GitHub Desktop.
A simple base for stupid interpreter in Python 3
# -*- coding: utf-8 -*-
def main():
"""
A python interpreter
https://ruslanspivak.com/lsbasi-part1/
"""
while True:
try:
# To run under Python3 replace 'raw_input' call
# with 'input'
text = input('do.py> ')
except EOFError:
break
if not text:
continue
# interpreter = Interpreter(text)
# result = interpreter.expr()
# print(result)
print(text)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment