Wednesday, February 07, 2018

[tbas] tbas basic interpreter

In my ample (NOT!) spare time, I'm helping out with a programming language project called tbas. I saw it advertised on comp.lang.basic.misc in September 2017 (yep, usenet is still going strong.)

The author is one Antonio Maschio from Italy.

You can get source, documentation and a CygWin binary from the main site. There are some examples on RosettaCode.

To give you an idea of the flavour of the language, the following is a simple CAESAR cipher implementation.

    LET MSG$ = ""
    LET OFFS = 0
    LINE INPUT "Message"; MSG$
    INPUT "Offset"; OFFS
    DIM TARG(LEN(MSG$))
    CHANGE MSG$ TO TARG
    FOR I = 1 TO UDIM(TARG)
        TARG(I) = TARG(I) + OFFS
    NEXT
    CHANGE TARG TO MSG$
    PRINT MSG$

An example of running the above

    >tbas CAESAR.BAS
    Message ? My dog's got fleas
    Offset ? 1
    Nz!eph(t!hpu!gmfbt

© Copyright Bruce M. Axtens, 2018

No comments: