Source Code Generation Tool

  • Thread starter logistix at cathoderaymission.net
  • Start date
L

logistix at cathoderaymission.net

#
# libraryOfBabel.py
#
# This is a general purpose source code generation tool.
#
# It generates any code you may require for python, perl, rexx,
# C, C++, befunge, ADA, ruby and other programming languages
#
# It will generate the source code for Python 3000
#
# It is also capable of generating the complete works of
# William Shakespeare, Friedrich Nietzsche,
# and Raymond Chandler
#

import sys

symbols = [chr(x) for x in range(128)]
symbols.remove(chr(7))

def indexToSymbol(index):
try:
return symbols[index]
except:
raise Exception("invalid index %i" % index)

def symbolToIndex(symbol):
try:
return symbols.index(symbol)
except:
raise Exception("Invalid Symbol '%s'" % symbol)

def generateDocument(number):
while number:
div,mod = number / len(symbols), number % len(symbols)
sys.stdout.write(indexToSymbol(mod))
number = div

i = 1401448258002517817034703038066348000649199218

while 1:
print '=' * 79
print 'DOCUMENT ID ', i
print '=' * 79
generateDocument(i)
i += 1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top