Jump to content
IGNORED

Batari Basic feature request: simple functions aka aliases for expressions


BenMcLean

Recommended Posts

I love Batari Basic. Am working on my first game and it's gonna rock.

 

There is one suggestion I would make about improving the Batari Basic language. It would only require changes to the parser, not the compiler.

 

The idea is that it would be really cool if I could say something like this:

a=7
function wut(in) {  in{7} || in{5} }
 
if wut(a) then COLUBK = $02

That would get translated by the parser into this:

a=7
 
if a{7} || a{5} then COLUBK = $02

before going on to be compiled just like Batari Basic programs are now.

 

That way, you could abstract all of your bitwise operations or other complicated conditions into one section of code, and only have to change them one place in your code to change them. Heck, if I was really determined, I could write a Python script for this. It could make code easier to read while at the same time making it easier to scrape together the use of every last bit in those 26 bytes of RAM. You'd be able to see statements like, "if isHeDead(badguy) then blah" instead of "if badguy{0} = 0 then blah"

 

Some other keyword like "expression" could be used instead of "function" if that's better.

 

It wouldn't change things on the assembly end at all. Heck, running a python script on your code before it gets to the batari basic tools could do this.

 

What do you think? Is there some technical reason why Batari Basic can't be expanded to include this which I haven't thought of?

Edited by BenMcLean
Link to comment
Share on other sites

Essentially, what I was thinking of here already exists! I just didn't know what it was called. Well, this is wonderful. Thanks. How can I delete this thread? :)

Link to comment
Share on other sites

Even though this exists, my experience in trying to use it today seems to have demonstrated that it's implementation is flawed because I've produced code that passes the syntax checker in Visual Batari Basic but which crashes the compiler for no apparent reason while removing the DEF statements makes my program compile and run fine.

Edited by BenMcLean
Link to comment
Share on other sites

Even though this exists, my experience in trying to use it today seems to have demonstrated that it's implementation is flawed because I've produced code that passes the syntax checker in Visual Batari Basic but which crashes the compiler for no apparent reason while removing the DEF statements makes my program compile and run fine.

 

Dunno what's happening without seeing the yadayada.bas file, dawg. Double check that you're using the latest version of bB too:

http://atariage.com/forums/topic/214909-bb-with-native-64k-cart-support-11dreveng/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...