<commit_before>#!/usr/bin/python3

import sys

from memory import *
from processor import *
from basic_graph import *

# a complete ready to use register machine
# 

if __name__=="__main__":
	r=Ram(400,registers="12/0,3,n;1,3,n;2,2,/dev/stdout;3,1,n;4,3,n;5,3,n;6,3,n;7,3,n;8,3,n;9,3,n;10,4,n;11,4,n;",register_count=12)
	if(len(sys.argv)<=2):
		print("usage: {} <command> <argument>".format(sys.argv[0]))
		raise BaseException("need command")
	if(sys.argv[1]=="procdef"):
		f=Flash(1000)
		p=Processor(ram=r,flash=f)
		p.__dump__(sys.argv[2])
		print("generated processor definition into file {}.".format(sys.argv[2]))
		sys.exit()
	if(sys.argv[1]=="execute"):
		fname=sys.argv[2]
		fil=open(fname,"r")
		flash_size=int(fil.readline())
		fil.close()
		f=Flash(flash_size,std_savename=fname.encode(),saved=True)
		p=Processor(ram=r,flash=f)
		g=BasicGraphics(r,10,11)
		p.process()
		input("hit enter to exit")
		sys.exit()
	print("command {} not recognized".format(sys.argv[1]))<commit_msg>fixed an import error<commit_after>#!/usr/bin/python3

import sys

from memory import *
from processor import *
use_gui = True
if( use_gui):
	try:
		from basic_graph import *
	except:
		print("warning: lcd alike graphics disables (no python3-tk found)")
		print("install python3-tk or set ``main.use_gui = False'' to disable this warning")
		use_gui = False

# a complete ready to use register machine
# 

if __name__=="__main__":
	r=Ram(400,registers="12/0,3,n;1,3,n;2,2,/dev/stdout;3,1,n;4,3,n;5,3,n;6,3,n;7,3,n;8,3,n;9,3,n;10,4,n;11,4,n;",register_count=12)
	if(len(sys.argv)<=2):
		print("usage: {} <command> <argument>".format(sys.argv[0]))
		raise BaseException("need command")
	if(sys.argv[1]=="procdef"):
		f=Flash(1000)
		p=Processor(ram=r,flash=f)
		p.__dump__(sys.argv[2])
		print("generated processor definition into file {}.".format(sys.argv[2]))
		sys.exit()
	if(sys.argv[1]=="execute"):
		fname=sys.argv[2]
		fil=open(fname,"r")
		flash_size=int(fil.readline())
		fil.close()
		f=Flash(flash_size,std_savename=fname.encode(),saved=True)
		p=Processor(ram=r,flash=f)
		if(use_gui):
			g=BasicGraphics(r,10,11)
		p.process()
		input("hit enter to exit")
		sys.exit()
	print("command {} not recognized".format(sys.argv[1]))
{'fraction_non_alphanumeric': 0.1999101527403414, 'fraction_numerical': 0.04582210242587601, 'mean_word_length': 6.092356687898089, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1702377', 'n_tokens_mistral': 999, 'n_tokens_neox': 930, 'n_words': 143}