Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
tyboro2002 authored Apr 24, 2022
1 parent 9a6aeb3 commit 9168dd4
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 0 deletions.
15 changes: 15 additions & 0 deletions TranToRP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#this project translate WestFlemishPython to regular Python code
import re
start = '(?<![A-Za-z])( ?\(? ?)'
end = '( ?[(\[]? ?)(?![A-Za-z])'

def translToRP(prog):
with open("translatore.txt","r") as translatore:
lines = translatore.readlines()
for line in lines:
line = line.strip().split(",")
prog = change(line[0],line[1],prog)
return prog

def change(van,naar,prog):
return re.sub(start + van + end, r'\1'+naar+r'\2', prog)
15 changes: 15 additions & 0 deletions TranToWFP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#this project translate WestFlemishPython to regular Python code
import re
start = '(?<![A-Za-z])( ?\(? ?)'
end = '( ?[(\[]? ?)(?![A-Za-z])'

def translToWFP(prog):
with open("translatore.txt","r") as translatore:
lines = translatore.readlines()
for line in lines:
line = line.strip().split(",")
prog = change(line[1],line[0],prog)
return prog

def change(van,naar,prog):
return re.sub(start + van + end, r'\1'+naar+r'\2', prog)
21 changes: 21 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#this project translate WestFlemishPython to regular Python code
from TranToRP import translToRP
from TranToWFP import translToWFP

#inp = input("want to load the program? y/n\n")
inp = "y"
if inp == "y":
with open("totrans","r") as file:
prog = file.read()
elif inp == "n":
prog = input("put your program here\n")

inp = input("to what you want to translate WFP/RP\n")
if inp == "WFP":
prog = translToWFP(prog)
print("WFP prog:\n" + prog)
if inp == "RP":
print("WFP prog:\n" + prog)
prog = translToRP(prog)
print("RP prog:\n" + prog)
exec(prog)
17 changes: 17 additions & 0 deletions output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
anders,else
zegt,print
verkloar,def
zelve,self
goat ervan ut,assert
at,if
gift were,return
oe lank,len
klasse,class
smiet erbie,add
leesd lintjes,readlines
me,with
smiet,raise
getalleke,int
zolangk,while
ise,isinstance
nie,not
48 changes: 48 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# this project translate WestFlemishPython to regular Python code
import re

start = '(?<![A-Za-z])( ?\(? ?)'
end = '( ?[(\[]? ?)(?![A-Za-z])'


def translToRP(prog):
prog = re.sub(start + r'voe ([A-Za-z]*) i' + end, r'\1for \2 in\3', prog)
with open("translatore.txt", "r") as translatore:
lines = translatore.readlines()
for line in lines:
line = line.strip().split(",")
prog = change(line[0], line[1], prog)
return prog


def translToWFP(prog):
prog = re.sub(start + r'for ([A-Za-z]*) in' + end, r'\1voe \2 i\3', prog)
with open("translatore.txt", "r") as translatore:
lines = translatore.readlines()
for line in lines:
line = line.strip().split(",")
prog = change(line[1], line[0], prog)
return prog


def change(van, naar, prog):
return re.sub(start + van + end, r'\1' + naar + r'\2', prog)


# inp = input("want to load the program? y/n\n")
inp = "y"
if inp == "y":
with open("totrans", "r") as file:
prog = file.read()
elif inp == "n":
prog = input("put in your program here\n")

inp = input("to what you want to translate WFP/RP\n")
if inp == "WFP":
prog = translToWFP(prog)
print("WFP prog:\n" + prog)
if inp == "RP":
print("WFP prog:\n" + prog)
prog = translToRP(prog)
print("RP prog:\n" + prog)
exec(prog)
43 changes: 43 additions & 0 deletions totrans
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#this project translate WestFlemishPython to regular Python code
import re
start = '(?<![A-Za-z])( ?\(? ?)'
end = '( ?[(\[]? ?)(?![A-Za-z])'

def translToWFP(prog):
prog = re.sub(start + r'for ([A-Za-z]*) in' + end, r'\1voe \2 i\3', prog)
with open("translatore.txt","r") as translatore:
lines = translatore.readlines()
for line in lines:
line = line.strip().split(",")
prog = change(line[1],line[0],prog)
return prog

def translToRP(prog):
prog = re.sub(start + r'voe ([A-Za-z]*) i' + end, r'\1for \2 in\3', prog)
with open("translatore.txt","r") as translatore:
lines = translatore.readlines()
for line in lines:
line = line.strip().split(",")
prog = change(line[0],line[1],prog)
return prog

def change(van,naar,prog):
return re.sub(start + van + end, r'\1'+naar+r'\2', prog)

#inp = input("want to load the program? y/n\n")
inp = "y"
if inp == "y":
with open("totrans","r") as file:
prog = file.read()
elif inp == "n":
prog = input("put your program here\n")

inp = input("to what you want to translate WFP/RP\n")
if inp == "WFP":
prog = translToWFP(prog)
print("WFP prog:\n" + prog)
if inp == "RP":
print("WFP prog:\n" + prog)
prog = translToRP(prog)
print("RP prog:\n" + prog)
exec(prog)
221 changes: 221 additions & 0 deletions translatore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
anders_at,elif
anders,else
zegt,print
verkloar,def
zelve,self
goat_ervan_ut,assert
at,if
gift_were,return
oe_lank,len
klasse,class
smiet_erbie,add
leesd_lintjes,readlines
me,with
smiet,raise
getalleke,int
zolangk,while
ise,isinstance
nie,not
makt_positief,abs
ollemoale,all
enen,any
basis_twee,bin
woar_of_nie,bool
basis_twee_listje,_bytearray
basis_twee_object,_bytes
karakterke,chr
klassemethode,classmethod
compliceerd,compile
gecompleceerd,complex
smiet_atribut_weg,delattr
dicionaire,dict
deelt_me_mod,divmod
nummerd,enumerate
doet_linke,eval
doet,exec
zeefde,filter
vliegend,float
vervroze_set,frozenset
kriegt,getattr
werelds,globals
et_atribuut,hasattr
smeerlaprie,hash
elpt_eke,help
basis_zestiene,hex
woar,id
vraagt_an_de_gebruker,input
is_underklasse,issubclass
overloopt,iter
listje,list
koarte,map
groatste,max
gegeughe_bekieke,memoryview
kliste,min
noasten,next
basis_achte,oct
doe_ope,open
leter_ze_nummer,ord
krachte,pow
stel_eki_voor,repr
keer_neki_om,reversed
koekeroende,round
sniedt,slice
sorteerd,sort
woordke,str
teld_up,sum
voadre,super
geordend_rijke,tuple
typeke,type
gift_oofd_letter,capitalize
lage_leterkes,casefold
zet_int_midde,center
teld,count
versleuteld,encode
endegd_me,endswith
vergroat_tabs,expandtabs
zoekt,find
posische,index
alpha_numerke,isalnum
al_leterkes,isalpha
is_decimale,isdecimal
is_cieferke,isdigit
is_naamke,isidentifier
is_nen_kleinen,islower
is_numerke,isnumeric
ku_je_roepe,isprintable
is_rumte,isspace
is_nen_groaten,isupper
smiet_tope,join
links_juste,ljust
makt_nen_kleinen,lower
linksen_striptiese,lstrip
vertaal_tafel,maketrans
kapt_in_drien,partition
vervangt,replace
rechts_zoeke,rfind
rechts_index,rindex
rechts_juste,rjust
rechts_in_drien_kappe,rpartition
rechts_in_stikke_kappe,rsplit
rechtsen_striptiese,rstrip
kapt_lienkes,splitlines
kapt,split
begint_me,startswith
striptiese,strip
makt_kleinen_groat_en_groate_kleine,swapcase
vertaald,translate
groaten,upper
nullekes_vulle,zfill
doet_olles_weg,clear
makt_nen_kopieke,copy
teld,count
verlengd,extend
stikt_erin,insert
poef,pop
smiet_weg,remove
van_ze_sleutels,fromkeys
kriegt,get
poef_item,popitem
zet_standoard,setdefault
woarden,values
verschil_e_veranderd,difference_update
verschil,difference
verwaarloosd,discard
bokst_e_veranderd,intersection_update
bokst,intersection
bokse,isdisjoint
oenderdeel_va,issubset
zit_i_derin,issuperset
spegel_verschil_e_veranderd,symmetric_difference_update
spegel_verschil,symmetric_difference
anjoens,union
doe_toe,close
aalt_eraf,detach
bestand_telefong,fileno
schast,flush
ku_je_etwuk_me_doe,isatty
leesd,read
leesboar,readable
leesd_lienke,readline
go_na,seek
ku_je_bewege,seekable
belt,tell
koptje_klinder_make,truncate
kuj_gie_schrieven,writable
schrieft_lienkes,writelines
schrieft,write
aalt_bine,import
ut,from
igenschap,property
alles_wa_gy_kunt,dir
is_da_ne_grote_zin,istitle
grote_zin,title
kunne_kik_joen_etwa_vroagn,callable
dinge,object
dingskes,items
pakske,zip
ge_moe_da_nog_eke_verandere,update
wa_wete_gy,vars
va_alles_eenke,set
van_doa_toet_doa_me_stapkes,range
beweuners,locals
vult_et_in,format
vult_et_in_me_naamkes,format_map
klasse_opdracht,staticmethod
olene_leesboare,ascii
is_olene_leesboare,isascii
zegt_tege_dinges_da_dink_dinges_is,setattr
woar,True
niwoar,False
gvd_tlukt_nie,except
achterof,finally
brikt,break
reet,as
nietn,None
probeerd_neke,try
nie,not
butelander,nonlocal
smiet_weg,del
lat_et_gerust,pass
doe_verdre,continue
of_anders,or
derin,in
ist_tzelste,is
en_wook,and
arbieder_zoender_name,lambda
gift_listje_were,yield
voe,for
ge_ku_nie_rekene,ArithmeticError
ge_kut_er_nie_vanut_goe,AssertionError
ge_e_gi_atributen,AttributeError
voadre_va_oal_de_uitzoenderinge,Exception
tblad_is_op,EOFError
ge_et_e_komma_vergete,FloatingPointError
generator_ut_trekke,GeneratorExit
ge_kriegt_et_nie_bine,ImportError
tis_nie_geklaseerd,KeyError
ge_e_ze_nie_genoeg_rumte_gegeve,IndentationError
tis_tevere,IndexError
bluft_me_je_fikken_va_me_knoppe,KeyboardInterrupt
ge_zie_blind,LookupError
nie_genoeg_verstand,MemoryError
te_nog_gi_name,NameError
stikt_et_der_eest_in_e,NotImplementedError
den_appel_valt_nie_verre_van_den_bome_tis_kapoet,OSError
ge_zegt_tevele,OverflowError
ge_ku_nie_referere,ReferenceError
den_utzoendering_der_utzoenderinge,RuntimeError
tis_op,StopIteration
ge_ku_nie_code_loser,SyntaxError
tis_oal_na_de_klote,SystemError
tis_oal_gedoan,SystemExit
nie_et_juste_typeke,TypeError
ge_roept_te_vroeg,UnboundLocalError
ge_moe_op_u_indentatie_lette,TabError
u_nie_code_problem,UnicodeError
u_nie_code_vercode,UnicodeEncodeError
u_nie_code_decode,UnicodeDecodeError
error404_u_nie_code_tolk_nie_gevonde,UnicodeTranslateError
tzit_nie_just,ValueError
ge_peisd_da_ge_olles_moogt_zekrs,ZeroDivisionError
_doet,:

0 comments on commit 9168dd4

Please sign in to comment.