Subtilis: A new BASIC-like compiler for RiscOS

handy tools that can assist in the development of new software
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Subtilis: A new BASIC-like compiler for RiscOS

Post by BigEd »

(Thanks for that! If this info is very hard to come by, I recommend uploading it to the Internet Archive. I can do that if you like - but then only I could update it.)
markdryan
Posts: 267
Joined: Sun Aug 20, 2017 11:37 pm
Contact:

Re: Subtilis: A new BASIC-like compiler for RiscOS

Post by markdryan »

Sophira wrote: Thu Oct 27, 2022 11:16 pm I know of another program you can add to your benchmarks, if you want. There was a BASIC-like compiler called !sBASIC (Simple BASIC) published in the *INFO column of the May 1992 issue of BBC Acorn User.
Thanks for posting this Sophira. I had fun playing around with !sBASIC this evening. For those of you who haven't tried it, !sBASIC compiles your program to BASIC assembler. When you run the generated BASIC file, it assembles your program and then runs it. I tried the primes program which works fine. I ported it to Subtilis and then had a mini battle of the compilers. On my 4MB A3000 (the program ran too quickly on the RiscPC) the !sBASIC compiled primes program took 1.79 seconds and the Subtilis version (see below) took 1.61. Thinking that most of the time was probably spent doing IO I removed the line that prints out the primes, i.e., IF ARRAY(a) THEN PRINT a; from both programs and reran. The !sBASIC version took .5secs and the Subtilis version took .34secs.

I only measured the execution time for the !sBASIC code (and not the assembly time). I disabled escape checking in the Subtilis compiler as !sBASIC doesn't seem to do this.

Here's the Subtilis version of the code. I modified it to use integers explicitly and to use local vars instead of globals.

Code: Select all

t% := TIME
local dim ARRAY%(10000)
a%:=0
WHILE a%<10000
  a%=a%+1
  ARRAY%(a%)=1
ENDWHILE

a%=1
WHILE a%<100
  a%=a%+1
  IF ARRAY%(a%) THEN
    b%:=a%
    WHILE b%<=10000-a%
      b%=b%+a%
      ARRAY%(b%)=0
    ENDWHILE
  ENDIF
ENDWHILE

a%=0
WHILE a%<10000
  a%=a%+1
  IF ARRAY%(a%) THEN PRINT a%; PRINT " "; ENDIF
ENDWHILE
PRINT ""
PRINT TIME-t%
Post Reply

Return to “development tools”