Spectacle (Programming Language) - *Update*

Everything else that doesn't fall into one of the other PB categories.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Spectacle (Programming Language) - *Update*

Post by Killswitch »

12/11/05 - Update

Well I've been working on Spectacle for well over a month now and I thought it's about time I relased an alpha, as I'm quite proud of how the langage is progressing!

This is more of a sneaky-peak relase, as many parts of the language are incomplete (such as the debugger, and many command sets). I've introduced a new feature: Result Warping. I don't know about you, but I really get annoyed having to use Str(), Val() (etc) lots and lots of times. So, with specticle you can define a return type of a command, in the same way you'd define a variables type!

Here's some code exaples:

Comments

Code: Select all

 Rem This is a comment

 Command Arg1,Arg2 Rem this isn't a valid comment 

 RemStart
   This is a comment
   This is a comment
 RemEnd

 'This is a comment

 Commadn Arg1,Arg2 'This is a valid comment
Maths

Code: Select all

 ;Bob.s
 ;Bob="bob"
 ;Jim.l=123+1
 DEF.l Tim, Kim
Operators

Code: Select all

+
-
*
/
^
<>
<=
>=
And
Not
Or
XOr
Binary, Octal and Hexadecimal support

Code: Select all

 ;%10101+7c8+0xDEADBEEF
Commands

Code: Select all

 
 Len "bob is cool"
 
 Val.l = Val "123"
 
 Bob.s = Len.s "Test" 'Will return 4 as string

Meta Expression

Code: Select all

 &Test=x+1
 ;&Test=1
 ;x.l=1
 ;&Test=2
I've also implimented a whole new, stack based, variable-handling system which has reduced memory usuage dramatically!

Here's the command set:

End
Val
ValF
Len
LCase
UCase
Right
Left
Asc
Chr
RTrim
LTrim
Trim
Space
Binary
Hex2Bin
Oct2Bin
Bin2Hex
Bin2Oct
hex2Dec
Oct2Dec
ElapsedMilliseconds
Wait
Rnd
RndF
Seed

I'd still like some help with the project, as well as ideas and comments! contray to what I've said before the source is avaliable as it's easier to see whats going on with it than the .exe.

To Spectacle code you must write your soure in a file called 'Code.txt' in the same directory as either the .exe or Main.pb (depending on how you want to run it).

The exe will probally look like it's doing nothing - that's why the source is included!

DOWNLOAD

Old News

Since the start of the summer I've been working on a project which has always been a dream since I started programming. I have been writing my own programming language using PureBasic. It's gone pretty well. The project has had two previous forms, 'Compound Basic' and 'Monocole'. The latter was a PureBasic clone and the former was an attempt at a scripting language. I've restarted the project with fresh idea's and I thought I'd share a few of them.

1. Run your program from an interpreted .exe, a virtual machine, another program (as a scripting language) or the stand alone interpreter.

2. Dynamic Expressions. You'll be able to define an expression as a variable, so the result of that expression is used instead of a variable with a specific value i.e.

Code: Select all

  $Test=x+1
  Debug $Test ;Test=1
  x=1
  Debug $Test ;Test=2
  x=-1
  Debug $Test ;Test=0

3. Extended BASIC Syntax. Standard BASIC keywords used (End, If/then) as well as some more advanced features, i.e.

Code: Select all

Bob.s="Jim"
Length.l = Bob.Len()
4. Cross compatibility, I'm hoping to get the language to work with every platform PB does - although this'll be a bit hard to do alone.

5. (Partially) Open Source. Anything I think that'll be useful (at the moment the commands and RPN functions) will be converted into a library for everyone to use. That way, even if none of you use this language, at least the community gets something out of the project. The actual interpreter code it's self will not be realsed - otherwise we'll be drowning in 'new' languages.

Well, I hop you like the feature list! I'm hoping to the the majority of the work myself, as quickly as possible however I'll need some help making it cross platform. If anybody would like to help in writing commands (which basically consist of procedures which copy the functionality of PB internal commands without actually using them) for Linux, OS X or Amiega OS (if there's much of a point) then that'd greatly be appreciated.

Anyway, comments, ideas and suggestions are very welcome!
Last edited by Killswitch on Sat Nov 12, 2005 6:54 pm, edited 2 times in total.
~I see one problem with your reasoning: the fact is thats not a chicken~
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

I would love to have a scripting language I could use in games and such.
Good luck with your project! :wink:
I like logic, hence I dislike humans but love computers.
Brice Manuel

Post by Brice Manuel »

I recommend reading:

Game Scripting Mastery and Virtual Machine Design and Implementation in C/C++

These will be a huge help to you if you really want to write your own programming language.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

I've already been pointed to those book's in another thread - but thanks :D. I'm writing this whole language in PB - I think it's upto it and I've had some pretty good results with the two previous projects. :D
~I see one problem with your reasoning: the fact is thats not a chicken~
Brice Manuel

Post by Brice Manuel »

I'm writing this whole language in PB - I think it's upto it and I've had some pretty good results with the two previous projects.
Wasn't in any way suggesting not using PB, what is taught in those books can be applied to any language you are using to write your programming language. :wink:
Post Reply