Page 1 of 1

EightBall - New Programming Language

Posted: Mon Nov 27, 2017 9:37 pm
by Bobbi
I have been doing a bit more work on my little programming language interpreter project and thought that maybe it was time to let some other people play with it. This started out as a VIC-20 project (VICScript) but now supports C64 and Apple IIe/c as well. Accordingly I renamed it to EightBall "The Eight Bit Algorithmic Language".

It is still a work in progress.

Source code, executables, disk images and documentation at https://github.com/bobbimanners/EightBa ... /Eightball

Here is a sample program, to give you a flavour:

Code: Select all

' Sieve of Eratosthenes                                                         
                                                                                
' Globals                                                                       
byte nr = 10                                                                    
word n = nr * nr                                                                
byte A[n] = 1                                                                   
                                                                                
pr.msg "Sieve of Eratosthenes ..."; pr.nl                                       
call doall()                                                                    
end                                                                             
                                                                                
sub doall()                                                                     
  call sieve()                                                                  
  call printresults()                                                           
return 0                                                                        
                                                                                
sub sieve()                                                                     
  word i = 0; word j = 0                                                        
  for i = 2 : (nr - 1)                                                          
    if A[i]                                                                     
      j = i * i                                                                 
      while (j < n)                                                             
        A[j] = 0                                                                
        j = j + i                                                               
      endwhile                                                                  
    endif                                                                       
  endfor                                                                        
return 0                                                                        
                                                                                
sub printresults()                                                              
  word i = 0                                                                    
  for i = 2 : (n - 1)                                                           
    if A[i]                                                                     
      if i > 2                                                                  
        pr.msg ", "                                                             
      endif                                                                     
      pr.dec i                                                                  
    endif                                                                       
  endfor                                                                        
  pr.msg "."                                                                    
return 0 

Re: EightBall - New Programming Language

Posted: Wed Nov 29, 2017 6:42 pm
by Kweepa
Pretty cool...
Can the interpreted language be compiled?
It looks like it might make fast code since you can declare bytes :)

Re: EightBall - New Programming Language

Posted: Wed Nov 29, 2017 8:30 pm
by Bobbi
Right now I am interpreting the text directly, which is slow. However it is quite convenient to be able to load and save ASCII files and exchange them between systems this way (with some help from petcat!)

I am planning on moving to a tokenized representation, which should speed things up. I am also thinking to implement a virtual machine and a simple compiler targeting it. I am open to suggestions as to the best approach ... obviously, memory is tight. This should be a fun project over the winter months, and I guess I will learn a lot about compiler development :)

First though, I want to stabilize this release, add multidimensional arrays and squash some bugs.

Re: EightBall - New Programming Language

Posted: Fri Apr 27, 2018 11:22 pm
by Bobbi
Took longer than I thought, but there is a new release of EightBall on my GitHub page:
https://github.com/bobbimanners/EightBall

There is now a

Code: Select all

comp
command which compiles the language to bytecode for the EightBall VM (also new with this release.) The compiled code runs much faster than interpreted code (even with the totally unoptimized VM I have at present.)

Documentation is included in the wiki on the GitHub page.

Enjoy!

Re: EightBall - New Programming Language

Posted: Sat Apr 28, 2018 12:20 pm
by Bobbi
Fixed a couple of bugs. Latest version is v0.52.

Re: EightBall - New Programming Language

Posted: Mon Jun 04, 2018 5:16 pm
by Bobbi
v0.76 is now available from https://github.com/bobbimanners/EightBall

There are numerous small improvements. The virtual machine has been optimized somewhat and compiled bytecode now runs a good deal faster than before.

Re: EightBall - New Programming Language

Posted: Mon Nov 19, 2018 7:56 pm
by dr.geek
Looks very interesting - i have been looking at the quetzalcoatl compiler which can produce prg's for an actual VIC. Do you see Eightball getting to this point?