Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

LCGS syntax update proposal #190

Open
Labels
discussionDetails are under discussionenhancementNew feature or request
@NicEastvillage

Description

@NicEastvillage

Future work from 8th semester includes updates to the LCGS syntax in order to make it more consistent and less tedious. This issue is for discussing how that new syntax would look like. Let's first state the design goals:

  • Remove inconsistent notation: Some declarations start with a keyword while others start with a variable name or other symbols. Our syntax should try to minimize the number of exceptions, e.g. by having all declarations start with a keyword.
  • Tedious duplicate code: If label or update expressions depend on the same complex expression, then the only
    solution currently, is to copy the expression. This should be solved with a abstraction like functions or similar.
  • (Extra) Only labels can be used in ATL: It would be nicer to express ATL queries if they could directly use the state variables in LCGS. This change to the ATL syntax would make the label declaration somewhat unnecessary unless we make it more versatile.

Initial proposal

I propose we update the syntax as follows:

  • Replace labels withexpr declarations.
    • These are values derived from the current state and do not have to be boolean.
    • They can be used in ATL queries like labels.
    • Can be used in other expressions reducing duplicate code (recursive definitions disallowed ofc).
    • They can have parameters, making them similar to functions.
  • Adddynexpr declarations.
    • These are similar to expr declarations, but they are derived at transition-time, meaning they can use player actions in their definition.
  • Addvar keyword for variables, simply prepended to the current syntax
    • Thevar keyword plus space is conveniently 4 letters, which makes it align with an indented update expression.
  • Addaction keyword
    • Replaces the square brackets around actions names for more consistency
    • Action name and condition is instead separated by:
  • Add explicit parameters to templates showing which identifiers must be relabeled
    • The characteristics of the parameters (e.g. whether it must be an identifier, or whether it must have certain fields) are infered for high versatility.
    • Whether relabeling is removed is TBD.

The Mexican Standoff would look like this with this proposed syntax:

const MAX_HEALTH = 2;player billy = cowboy(clayton, jesse);player clayton = cowboy(jesse, billy);player jesse = cowboy(billy, clayton);expr over = billy.dead + clayton.dead + jesse.dead >= 2;template cowboy(target1, target2)        var health : [0..MAX_HEALTH] init MAX_HEALTH;        health' = max(health - target1.shoot_left - target2.shoot_right, 0);    expr alive = health > 0;    expr dead = !alive;    expr something_with_params(a, b) = a * 2 > b;    dynexpr hit = target1.shoot_left || target2.shoot_right;    action wait : 1;    action shoot_right : health > 0 && target1.health > 0;    action shoot_left : health > 0 && target2.health > 0;endtemplate

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDetails are under discussionenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp