Formal Definitions Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Desired Features for Zillions of Games » Formal Definitions « Previous Next »

Author Message
Ronald W Brierley (Ronaldwb)
Posted on Monday, June 16, 2003 - 10:04 am:   

I would like there to be available files formally defining the syntax of the ZRF Language and the semantics of the ZRF Language. This would help some of us ZoG programmers with such problems as where to and where not to place brackets. It might be thought best to leave such files to be only accessible from the web site but I find the ability to access the ZRF Language Reference keywords file from within the ConText editor to be extremely useful.
Jeff Mallett (Jeffm)
Posted on Monday, June 16, 2003 - 1:16 pm:   

In the language reference there is a light blue area for each keyword where the formal definition of the syntax (the grammar) involving the keyword is provided. You should use parentheses only where these definitions specify that you should. The language uses parentheses pretty consistently, so I should be able to come up with a rule of thumb to help you. I'll try...

1) Put parentheses around Zillions commands:
( <command> <arg1> ... <argN> )
unless the command is in piece move code and it has no arguments, in which case use the keyword alone.

2) Put parentheses around all macro calls:
( <macro-name> <arg1> ... <argN> )
whether or not it has arguments.

3) In a few instances, parentheses are also needed to group data into chunks. Commands which may need this are absolute/relative-config, dimensions, board-setup, links, positions, symmetry, turn-order, unlink, win/loss/draw-condition, and zone. I'm not sure if this is a comprehensive list, but you can always look up any particular command in the reference.

4) Other than this, don't put parentheses. For example, don't put parentheses around your variables.

I hope this helps. I'll add something like this to the next revision of the documentation.
Ronald W Brierley (Ronaldwb)
Posted on Tuesday, June 17, 2003 - 12:04 pm:   

Thank you, Jeff, for replying so quickly.
After studying the code in my own program, which executes correctly, I realised that I had followed the correct syntax for a definition of the moves of a piece but I had subsequently not remembered that the items contained in the sequence must be each a bracketed set of commands. It was when I tried to improve the efficiency by introducing an if-else instruction that my bracketing started to give syntax errors which unfortunately did not succeed in pointing me to my bracketing errors. I hope now to succeed. This is another of your type three cases.
Many thanks,
Ronald
Jeff Mallett (Jeffm)
Posted on Tuesday, June 17, 2003 - 12:22 pm:   

Correct. "drops" and "moves" should have been included too. A set of instructions with parentheses around it forms a single unit -- a move block. This is important, because when a "verify" fails or when a null direction link is followed, move generation skips out of the current move block and onto the next. This could be explained better in the reference.

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: