Skip to content

Instantly share code, notes, and snippets.

View strickyak's full-sized avatar

Strick Yak strickyak

View GitHub Profile
@sma
sma / basic.py
Created December 27, 2009 16:50
A simple BASIC interpreter that can run the old HAMURABI game
from __future__ import division
from math import trunc
from random import random
import re
TOKENS = re.compile(r'(?<=REM).*|\.?\d+|\w+\$?|[():;=+\-*/]|<[=>]?|>=?|"[^"]*"')
class Basic(object):
def __init__(self, filename):
self.tokens = []