Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Is there a fully documented grammar available?

Years of Service
User Offline
Joined: 30th Apr 2022
Posted: 12th Sep 2023 22:34
I'm new to AGK. Reading through documentation for the DrawBox command, I discovered this line of code in one of the examples:

I was surprised to see the ":" character used as a statement delimiter as I didn't see it elsewhere in the documentation. I'm wondering what other language features I've missed. Is there a BNF (or even something less formal) for the AppGameKit language available somewhere? I know about the language section of the documentation, but it only covers keywords and not any other tokens or grammatical structures.
Virtual Nomad
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 15th Sep 2023 01:56 Edited at: 15th Sep 2023 01:58
not sure what a BNF is but there are examples of : usage in places like THIS (see Sorting & Searching).

unfortunately the docs don't cover everything, and as i'm "self taught" and came from a (relatively short) DBPro background where the once-popular 20 line challenges couldn't have existed without : usage, i've known about it for some time but can appreciate your desire for formal, exhaustive documentation.

related, perhaps, is that AppGameKit doesn't provide line wrap or concatenation which, IIRC, DBPro did.

anyway, hope that helps. and, welcome
Kevin Picone
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 15th Sep 2023 04:40

For those familiar with BASIC colons are common place; for others yeah not so much..

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
Years of Service
User Offline
Joined: 30th Apr 2022
Posted: 15th Sep 2023 08:16
Alright, thanks anyways. And I'd definitely enjoy multi-line statements too! It looks like they sometimes work... but only in function calls, when the line breaks are between function arguments, and only within the topmost function if several calls are nested.
Also, what is the use for commas? It seems like I can use them the same way as the colons, but only with variable declarations? Like this:

but not like this:

It seems weird to have since : can be used the same way without that restriction, so I thought I'd ask just in case there's more to it than I can figure just by testing. Would have been nice to declare multiple variables of the same type like in C, but it only works if each type is explicitly declared individually.
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 16th Sep 2023 15:56
I would avoid using comma declarations as it isn't well implemented in AGK.
It was considerably better implemented in DBP...

For example:

Type Vector
X, Y, Z As Float

Would work in DBP., where-as this will ONLY declare the first Variable in AGK
If you want to do the same in AppGameKit you have to do

Type Vector
X As Float, Y As Float, Z As Float

Which is pointless as you can just as easily use : (new instruction line) or just write on a new line
The entire point in , (instance previous instruction) is to reduce writing the same text over and over again for larger numbers of variables or instructions for Macro Functions (but then AppGameKit doesn't support that either)

Now what would be MUCH more useful but again while is supported in DBP but not AppGameKit is _ (Continue Line) ... which allows you to continue an Instruction Line over Multiple Lines, where the Compiler / Runtime would see it all as a single instruction line.
Given that AppGameKit is MUCH more verbose than DBP., this would be exceptionally more useful.
Not just in terms of not having Lines that can be Hundreds of Characters long (meaning you MUST side scroll to see the whole line) but also makes said lines considerably less readable.
It's a common practise in C-Languages but also DBP, to make heavy usage of the '_' symbol to break up an instruction line; so say a Function that inputs Position, Colours, etc. in a single command can place these on their own line to become more readable; so even without comments you can still understand what's going on, but more to the point is Mid-Line Comments.

Again, while DBP handled these fine (as Comments are simply stripped from Code in pre-processing before Compilation) these are handled as "Instructions" in AGK
This means having commands after #Constant (for example) means it copies the comment with the Constant (as this is a simplified Static Pattern Replace) but also if you have it say inline with /* your comment */; well this _can_ potentially break the command; and I've not even found consistent behaviour for this, so I have to consciously remember to write comment notes as a description block or above whatever I want to command... which is counterintuitive to how I typically program in C++, as when I have a comment for that I just place down a block as and where it is needed; usually in conjunction with the '_' concate symbol.

As a result of all the 'odd' behaviour along with how much AppGameKit just doesn't support., it tends to mean I write more verbose code in AppGameKit simply to ensure it behaves properly.

Login to post a reply

Server time is: 2023-09-24 20:52:43
Your offset time is: 2023-09-24 20:52:43