compile essays to python

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

compile essays to python

#1 Post by nosystemdthanks »

this language was created in 7 hours to make a point about free culture.

it may only be relevant to people who support free software and who have argued for or against free cultural licenses for non-software works.

it converts arbitrary english essays (or other essays written in ascii) to python (2/pypy 2) code.

a hello world program:

Code: Select all

%bbvahpbvaepbvalpbvalpbvaopibap vawpbvaopbvarpbvalpbbvadp
output:

Image

richard stallmans "saying no to unjust computing even once is help":

Image

"the right to read":

Image

i realise these are not spectacular outputs. there is a clear screen command, and the language is not only "graphical"-- it also sets variables, lets you create loops, clear and append variables, do conditionals--

stallmans "the right to read" compiles to 29 kloc, the last dozen lines of which are:

Code: Select all

    if locolour < 0: locolour = 7
    colour(locolour, 0)
    xy(locx, locy, locolour)
    for loop747 in range(figure('r', vars, 'n')):
        if locx > 0: locx -= 1
        xy(locx, locy, locolour)
    locolour -= 1
    if locolour < 0: locolour = 7
    colour(locolour, 0)
    vars['r'] = ''
    lutog = 0
    colour(7, 0)
here is a full "manual" of the language:

Code: Select all

    # % turn on/off printing
    # @ quit program
    # a, A cycle colour backwards
    # b, B cycle colour
    # c, C copy next variable value to following character variable
    # d, D move down most recent variable value
    # e, E toggle print default upper/lower (starts lower)
    # f, F move to 1, 1
    # g, G get next character variable value
    # h, H append next variable value to following character variable
    # i, I set next variable to empty string
    # j, J fi
    # k, K if most recent variable value is true, do the following
    # l, L move left most recent variable value
    # m, M convert most recent value to uppercase
    # n, N convert most recent value to lowercase
    # o, O set next variable to 0
    # p, P print most recent variable value
    # q, Q exit loop early (limited)
    # r, R move right most recent variable value
    # s, S turn off print default case
    # t, T set next variable to random number 0 to 99
    # u, U move up most recent variable value
    # v, V set next letter to following character
    # w, W loop most recent variable value times
    # x, X mark end of loop
    # y, Y wait next value seconds
    # z, Z clear screen
cat saying-no-even-once.txt | ./diogenes.py > man.py ; pypy2 ./man.py

if you have python2 installed, you can use that instead of pypy:

cat saying-no-even-once.txt | python2 diogenes.py > man.py ; python2 ./man.py

as usual, this isnt really a zip file. just rename it without the .zip
Attachments
diogenes.py.zip
(11.26 KiB) Downloaded 141 times
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

Post Reply