Simon McGregor on Wed, 28 Jul 2010 08:23:58 -0700 (MST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[game-lang] Language Syntax


If we aren't following GDL's syntax, what might we use?

I'm personally a fan of Python's indentation syntax (parentheses in
code are usually redundant), and the use of object-oriented syntactic
constructs. Python's list comprehension syntax is pretty neat as well.
But please let's not use 'lambda' if we want lambda functions! (I'm
always trying to write code in Python where one of the parameters is
called lambda. Plus, 'lambda' looks ugly.)

If our language supports a concept of collections (pseudo-sets), can
we think about defining relational predicates in such a way that an
object-oriented syntax can be used on them?

e.g.

# define the relation "(player has_piece_on space)"
# "Player" and "Space" are types of object; "Infix" declares an infix relation

Infix has_piece_on(Player.spaces_present player, Space.players_present
space) <=>
  Exists( $piece Such_That ($piece on space) and ($piece belongs player) )

# "player.spaces_present" is now a shorthand for
#    $x Such_That (player has_piece_on $x)

#  and "space.players_present" is a shorthand for
#    $x Such_That ($x has_piece_on space)

# perhaps even allowing "player.spaces_present.players_present" to mean
#    $y Such_That Exists( $x Such_That ($y has_piece_on $x) and
(player has_piece_on $x) )

# and hence "target in player.spaces_present.players_present" to mean
#   Exists( $x Such_That (target has_piece_on $x) and (player
has_piece_on $x) )

Obviously, I'm not a logician so I'm sure there are tons of problems
with this general syntax (and I recognise it has already abandoned
first-order logic), but you get the idea.


Simon
_______________________________________________
game-lang mailing list
game-lang@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/game-lang