(notonline)-->
-- demo\rosetta\inverted_syntax.exw
without js
constant pun = split(join_by("()[]=,-",7,1,"","*"),"*",true)
constant nup = split(join_by(")(][=,-",7,1,"","*"),"*",true)
constant rip = split(join_by(" <>{}@!- ",7,3,"","*"),"*",true)
function mung(string pgm)
sequence lines=reverse(split(substitute_all(pgm,pun,rip),"\r\n"))
for i=1 to length(lines) do lines[i] = substitute_all(join(reverse(split(lines[i]))),rip,nup) end for
return join(lines,"\n")
end function
sequence cl = command_line()
string pgm = get_text(cl[$])
include write_file.e
{} = write_file("test.exw",mung(pgm)&"\n")
if length(cl)>2 then
system(cl[1]&"test.exw")
end if