Is there a programming language that is combination of Python and Basic?

Ivan Illarionov ivan.illarionov at gmail.com
Tue Apr 21 06:37:38 EDT 2009


On Apr 18, 3:39 pm, BJörn Lindqvist <bjou... at gmail.com> wrote:
> I first started programming basic and i don't think it has hurt me much.
>
> I can somewhat sympathise with the op, neither python nor any other
> mainstream language can still do this:
>
> SCREEN 13
> PSET 160,100,255

This is not true. It's trivial with pygame or equivalent SDL
bindings in other mainstream languages:

basic.py:
-------------------------------------------------------------------------------
import sys
import pygame

class BasicInterpreter:
    def SCREEN(self, x):
        self.surface = pygame.display.set_mode(
            (320, 200), pygame.FULLSCREEN, 8)

    def PSET(self, x, y, c):
        self.surface.set_at((x, y), c)
        pygame.display.flip()

if __name__ == '__main__' and len(sys.argv) > 1:
    basic = BASIC()
    with open(sys.argv[1]) as bas:
        for line in bas:
            eval("basic.%s(%s)" % tuple(x.strip() for x in line.split
(' ', 1)))
    while True:
        for event in pygame.event.get():
            if event.type in (pygame.QUIT, pygame.KEYDOWN):
                sys.exit(0)

-------------------------------------------------------------------------------

This will execute your BASIC program.

--
Ivan



More information about the Python-list mailing list