Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
O OPALManualWiki
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Code Review
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • snuverink_j
  • OPALManualWiki
  • Wiki
  • syntax

Last edited by Jochem Snuverink Sep 13, 2017
Page history

syntax

Table of Contents
  • 1. OPAL Language Syntax
    • 1.1. Statements:
    • 1.2. Real expressions:
    • 1.3. Real variables and constants:
    • 1.4. Logical expressions:
    • 1.5. Logical variables:
    • 1.6. String expressions:
    • 1.7. String constants:
    • 1.8. Real array expressions:
    • 1.9. Real array definitions:
    • 1.10. Constraints:
    • 1.11. Variable references:
    • 1.12. Token lists:
    • 1.13. Regular expressions:

1. OPAL Language Syntax

Words in italic font are syntactic entities, and characters in monospaced font must be entered as shown. Comments are given in bold font.

1.1. Statements:

comment

:

// anything-except-newline

|

/ anything-except-`/` */

identifier

:

[a-zA-Z][a-zA-Z0-9-]

integer

:

[0-9]+

string

:

’`anything-except-single-quote’`

|

“anything-except-double-quote”

command

:

keyword attribute-list

|

label : keyword attribute-list

keyword

:

identifier

label

:

identifier

attribute-list

:

empty

|

attribute-list , attribute

attribute

:

attribute-name // only for logical attribute

|

attribute-name = attribute-value

// expression evaluated

|

attribute-name := attribute-value

// expression retained

attribute-name

:

identifier

attribute-value

:

string-expression

|

logical-expression

|

real-expression

|

array-expression

|

constraint

|

variable-reference

|

place

|

range

|

token-list

|

token-list-array

|

regular-expression

1.2. Real expressions:

real-expression

:

real-term

|

+ real-term

|

- real-term

|

real-expression + real-term

|

real-expression - real-term

real-term

:

real-factor

|

real-term * real-factor

|

real-term / real-factor

real-factor

:

real-primary

|

real-factor ^ real-primary

real-primary

:

real-literal

|

symbolic-constant

|

#

|

real-name

|

array [ index ]

|

object-name → real-attribute

|

object-name → array-attribute [ index ]

|

table-reference

|

real-function ()

|

real-function ( real-expression )

|

real-function ( real-expression , real-expression )

|

function-of-array ( array-expression )

|

( real-expression )

real-function

:

RANF

|

GAUSS

|

ABS

|

TRUNC

|

ROUND

|

FLOOR

|

CEIL

|

SIGN

|

SQRT

|

LOG

|

EXP

|

SIN

|

COS

|

ABS

|

TAN

|

ASIN

|

ACOS

|

ATAN

|

ATAN2

|

MAX

|

MIN

|

MOD

|

POW

function-of-array

:

VMIN

|

VMAX

|

VRMS

|

VABSMAX

1.3. Real variables and constants:

real-prefix

:

empty

|

REAL

|

REAL CONST

|

CONST

real-definition

:

real-prefix real-name = real-expression

// expression evaluated

|

real-prefix real-name := real-expression

// expression retained

symbolic-constant

:

PI

|

TWOPI

|

DEGRAD

|

RADDEG

|

E

|

EMASS

|

PMASS

|

HMMASS

|

UMASS

|

CMASS

|

MMASS

|

DMASS

|

XEMASS

|

CLIGHT

|

real-name

real-name

:

identifier

object-name

:

identifier

table-name

:

identifier

column-name

:

identifier

1.4. Logical expressions:

logical-expression

:

and-expression

|

logical-expression || and-expression

and-expression

:

relation

|

and-expression && relation

relation

:

logical-name

|

TRUE

|

FALSE

|

real-expression relation-operator real-expression

logical-name

:

identifier

relation-operator

:

==

|

!=

|

<

|

>

|

>=

|

⇐

1.5. Logical variables:

logical-prefix

:

BOOL

|

BOOL CONST

logical-definition

:

logical-prefix logical-name = logical-expression

// expression evaluated

|

logical-prefix logical-name `:=` logical-expression

// expression retained

1.6. String expressions:

string-expression

:

string

|

identifier // taken as a string

|

string-expression & string

1.7. String constants:

string-prefix

:

STRING

string-definition

:

string-prefix string-name = string-expression

// expression evaluated

|

string-prefix string-name := string-expression

// expression retained

1.8. Real array expressions:

array-expression

:

array-term

|

+ array-term

|

- array-term

|

array-expression + array-term

|

array-expression - array-term

array-term

:

array-factor

|

array-term * array-factor

|

array-term / array-factor

array-factor

:

array-primary

|

array-factor ^ array-primary

array-primary

:

{ array-literal }

|

array-reference

|

real-function ( array-expression )

|

( array-expression )

array-literal

:

real-expression

|

array-literal , real expression

array-reference

:

array-name

|

object-name → array-attribute

array-name

:

identifier

1.9. Real array definitions:

array-prefix

:

REAL VECTOR

array-definition

:

array-prefix array-name = array-expression

|

array-prefix array-name := array-expression

1.10. Constraints:

constraint

:

array-expression constraint-operator array-expression

constraint-operator

:

==

|

<

|

>

1.11. Variable references:

variable-reference

:

real-name

|

object-name → attribute-name

1.12. Token lists:

token-list

:

anything-except-comma

token-list-array

:

token-list

|

token-list-array , token-list

1.13. Regular expressions:

regular-expression

:

“UNIX-regular-expression”

Clone repository
  • autophase
  • beam command
  • benchmarks
  • control
  • conventions
  • distribution
  • elements
  • fieldmaps
  • fieldsolvers
  • format
  • geometry
  • Home
  • introduction
  • lines
  • opal madx
View All Pages