Skip to content

Instantly share code, notes, and snippets.

View bekhzod91's full-sized avatar

Bekhzod bekhzod91

  • Storfox
  • Uzbekistan Tashkent
View GitHub Profile
anonymous
anonymous / cc.py
Created December 1, 2011 10:47
Useless C subset compiler
#!/usr/bin/env python
import sys
class Lexer:
NUM, ID, IF, ELSE, WHILE, DO, LBRA, RBRA, LPAR, RPAR, PLUS, MINUS, LESS, \
EQUAL, SEMICOLON, EOF = range(16)
SYMBOLS = { '{': LBRA, '}': RBRA, '=': EQUAL, ';': SEMICOLON, '(': LPAR,