Welcome to the Bartels Group of Companies
Syntaxdefinition - Deutsche Version Syntax Definition - English Version
Bartels

Bartels System GmbH
Bartels
Bartels AutoEngineer
BAE Product Info
BAE Price List
BAE Downloads
BAE Documentation
BAE Installation Guide
BAE User Manual
BAE Libraries
User Language Programmer's Guide
Preface
1 Introduction
2 Language Description
2.1 Introducing User Language Programming
2.2 Lexical Conventions
2.3 Data Types and Definitions
2.4 Expressions
2.5 Control Structures
2.6 Preprocessor Statements
2.7 Syntax Definition
3 Programming System
4 BAE User Language Programs
A Conventions and Definitions
B Index Variable Types
C System Functions
BAE Update History
BAE Next Version Release Notes Preliminary
BAE V8.0 Release Notes
BAE V7.8 Release Notes
BAE V7.6 Release Notes
BAE V7.4 Release Notes
BAE V7.2 Release Notes
BAE V7.0 Release Notes
BAE V6.8 Release Notes
BAE V6.6 Release Notes
BAE V6.4 Release Notes
BAE V6.2 Release Notes
BAE V6.0 Release Notes
BAE V5.4 Release Notes
BAE V5.0 Release Notes
BAE V4.6 Release Notes
BAE V4.4 Release Notes
BAE V4.2 Release Notes
BAE V4.0 Release Notes
BAE V3.4 Release Notes
BAE Support
BAE Contributions
BAE Development and Service Companies
Electronics Development
Bartels Sport Service
Company Profile
Corporate Info
Bartels :: Bartels AutoEngineer :: BAE Documentation :: User Language Programmer's Guide :: Language Description :: Syntax Definition
Bartels User Language - Programmer's Guide

2.7 Syntax Definition

Bartels AutoEngineer® Dokumentation

The following listing contains a BNF (Backus Naur Form) description of the User Language source code syntax. Comments are delimited by /* and */. The colon (:) corresponds with an assignment operator and is to be read as "is composed of". The vertical line (|) designates alternatives and is to be read as "or". Identifiers are denoted by the IDENT symbol, constants are marked by NUMBER (numeric), SQSTR (character) and DQSTR (string), respectively. The EOLN symbols defines the end-of-line control character. Boldfaced words or character sequences represent the terminal symbols (reserved words and/or operators).

/* User Language Source Code Syntax */

/* Program definition */

program
        : progdefs
        ;

progdefs
        : progdefs progdef
        |
        ;

progdef
        : preproccmd
        | typedef
        | storageclass vardef
        | storageclass fctdef
        ;

/* Preprocessor command */

preproccmd
        : #include DQSTR EOLN
        | #define IDENT optexpr EOLN
        | #undef IDENT EOLN
        | #if expression EOLN
        | #ifdef IDENT EOLN
        | #ifndef IDENT EOLN
        | #else EOLN
        | #endif EOLN
        | #bnf { syntaxdef } 
        | #pragma pragmaval
        ;

pragmaval
        : ULCALLERSTD
        | ULCALLERCAP
        | ULCALLERSCM
        | ULCALLERLAY
        | ULCALLERGED
        | ULCALLERAR
        | ULCALLERCAM
        | ULCALLERCV
        | ULCALLERICD
        | ULCALLERCED
        | ULCALLERNOUNDO
        ;

/* Type definition */

typedef
        : typedef declaration
        ;

/* Variable definition */

vardef
        : typespec initdecs ; 
        ;

/* Function definition */

fctdef
        : fcttype IDENT ( fctpars ) fctpardecs { cmditems }         ;

fcttype
        : typespec
        | void 
        |
        ;

fctpars
        : fctpardefs
        |
        ;

fctpardefs
        : fctpardefs , IDENT
        | IDENT
        ;

fctpardecs
        : fctpardecs vardef
        |
        ;

/* Storage class */

storageclass
        | static 
        | structdef
        ;

/* Type specification */

typespec
        : int 
        | double 
        | char 
        | string 
        | index IDENT
        | structdef
        | IDENT
        ;

/* Struct definition */

structdef
        : struct IDENT
        | struct IDENT { members } 
        | struct { members } 
        ;

members
        : members declaration
        | declaration
        ;

/* Declaration */

declaration
        : typespec decs ; 
        ;

decs
        : decs , declarator
        | declarator
        ;

/* Initialized declarator list */

initdecs
        : initdecs , initdec
        | initdec
        |
        ;

initdec
        : declarator
        | declarator = initializer
        ;

/* Declarator */

declarator
        : IDENT
        | declarator [ ] 
        ;

/* Initializer */

initializer
        : assignment
        | { initializers } 
        ;

initializers
        : initializers , initializer
        | initializer
        ;

/* Command block */

cmdblock
        : { cmditems } 
        | cmditem
        ;

/* Command list */

cmditems
        : cmditems cmditem
        |
        ;

/* Command item */

cmditem
        : preproccmd
        | typedef
        | vardef
        | ifcmd
        | switchcmd
        | forcmd
        | whilecmd
        | docmd
        | forallcmd
        | return optexpr ; 
        | break ; 
        | continue ; 
        | optexpr ; 
        ;

/* If control structure */

ifcmd
        : if ( expression ) cmdblock elsecmd
        ;

elsecmd
        : else cmdblock
        |
        ;

/* Switch control structure */

switchcmd
        : switch ( expression ) { caseblocks } 
        ;

caseblocks
        : caseblocks caseblock
        |
        ;

caseblock
        : cases cmditems
        ;

cases
        : cases case
        | case
        ;

case
        : case expression : 
        | default : 
        ;

/* For control structure */

forcmd
        : for ( optexpr ; optexpr ; optexpr ) cmdblock
        ;

/* While control structure */

whilecmd
        : while ( expression ) cmdblock
        ;

/* Do control structure */

docmd
        : do cmdblock while ( expression ) ; 
        ;

/* Forall control structure */

forallcmd
        : forall ( IDENT forallof forallwhere ) cmdblock
        ;

forallof
        : of IDENT
        |
        ;

forallwhere
        : where expression
        |
        ;

/* Expression */

optexpr
        : expression
        |
        ;

expression
        : expression , assignment
        | assignment
        ;

/* Assignment */

assignment
        : unary = assignment
        | unary |= assignment
        | unary ^= assignment
        | unary &= assignment
        | unary <<= assignment
        | unary >>= assignment
        | unary += assignment
        | unary -= assignment
        | unary *= assignment
        | unary /= assignment
        | unary %= assignment
        | conditional
        ;

/* Conditional evaluation */

conditional
        : log_or
        | log_or ? conditional : conditional
        ;

/* Logical OR */

log_or
        : log_and
        | log_and || log_or
        ;

/* Logical AND */

log_and
        : bit_or
        | bit_or && log_and
        ;

/* Bit OR */

bit_or
        : bit_xor
        | bit_or | bit_xor
        ;

/* Bit Exclusive OR */

bit_xor
        : bit_and
        | bit_xor ^ bit_and
        ;

/* Bit AND */

bit_and
        : equality
        | bit_and & equality
        ;

/* Equivalence comparison */

equality
        : comparison
        | equality == comparison
        | equality != comparison
        ;

/* Comparison */

comparison
        : shift
        | comparison < shift
        | comparison <= shift
        | comparison > shift
        | comparison >= shift
        ;

/* Shift operations */

shift
        : sum
        | shift << sum
        | shift >> sum
        ;

/* Addition and substraction */

sum
        : product
        | sum + product
        | sum - product
        ;

/* Multiplication and division */

product
        : unary
        | product * unary
        | product / unary
        | product % unary
        ;

/* Unary operators */

unary
        : primary
        | primary ++ 
        | primary -- 
        | - unary
        | ! unary
        | ~ unary
        | ++ unary
        | -- unary
        ;

/* Primary operators */

primary
        : IDENT
        | NUMBER
        | SQSTR
        | DQSTR
        | ( expression ) 
        | IDENT ( optexpr ) 
        | primary [ expression ] 
        | primary . IDENT
        ;

/* BNF Precompiler syntax definition */

syntaxdef
        : commentdef grammar
        ;

commentdef
        : COMMENT ( commentdel commentend ) ; 
        |
        ;

commentend
        : , commentdel
        |
        ;

commentdel
        : SQSTR
        | DQSTR
        ;

grammar
        : grammar rule
        | rule
        ;

rule
        : IDENT : forms ; 
        | IDENT : forms | ; 
        ;

forms
        : form | forms
        | form
        ;

form
        : form symbol action
        | symbol action
        ;

symbol
        : IDENT
        | SQSTR
        | DQSTR
        | IDENT 
        | NUMBER 
        | SQSTR 
        | DQSTR 
        | EOLN 
        | EOF 
        | EOFINC 
        | UNKNOWN 
        ;

action
        | ( IDENT ( NUMBER ) ) 
        | ( IDENT ) 
        |
        ;

/* BNF syntax description file end */
Bartels :: Bartels AutoEngineer :: BAE Documentation :: User Language Programmer's Guide :: Language Description :: Syntax Definition

Syntax Definition
© 1985-2024 Oliver Bartels F+E • Updated: 11 October 2010, 10:48 [UTC]

© 1985-2024 Oliver Bartels F+E Bartels Homepage Contact and Corporate Info

Web Development by Baumeister Mediasoft Engineering

Syntaxdefinition - Deutsche Version Syntax Definition - English Version