Willkommen bei Bartels
Syntaxdefinition - Deutsche Version Syntax Definition - English Version
Bartels

Bartels System GmbH
Bartels
Bartels AutoEngineer
BAE Produktinfo
BAE Preisliste
BAE Downloads
BAE Dokumentation
BAE Installationsanleitung
BAE Benutzerhandbuch
BAE Bibliotheken
User Language Programmierhandbuch
Vorwort
1 Einleitung
2 Sprachbeschreibung
2.1 Einführung in die User Language Programmierung
2.2 Konventionen
2.3 Datentypen und Definitionen
2.4 Ausdrücke
2.5 Kontrollstrukturen
2.6 Preprozessor-Anweisungen
2.7 Syntaxdefinition
3 Programmiersystem
4 BAE User Language-Programme
A Konventionen und Definitionen
B Index-Variablen-Typen
C Systemfunktionen
BAE Update-Historie
BAE Nächste Version Freigabemitteilungen Vorabinfo
BAE V8.0 Freigabemitteilungen
BAE V7.8 Freigabemitteilungen
BAE V7.6 Freigabemitteilungen
BAE V7.4 Freigabemitteilungen
BAE V7.2 Freigabemitteilungen
BAE V7.0 Freigabemitteilungen
BAE V6.8 Freigabemitteilungen
BAE V6.6 Freigabemitteilungen
BAE V6.4 Freigabemitteilungen
BAE V6.2 Freigabemitteilungen
BAE V6.0 Freigabemitteilungen
BAE V5.4 Freigabemitteilungen
BAE V5.0 Freigabemitteilungen
BAE V4.6 Freigabemitteilungen
BAE V4.4 Freigabemitteilungen
BAE V4.2 Freigabemitteilungen
BAE V4.0 Freigabemitteilungen
BAE V3.4 Freigabemitteilungen
BAE Support
BAE Contrib
BAE Entwickler und Dienstleister
Elektronikentwicklung
Sport
Firmenprofil
Impressum
Bartels :: Bartels AutoEngineer :: BAE Dokumentation :: User Language Programmierhandbuch :: Sprachbeschreibung :: Syntaxdefinition
Bartels User Language - Programmierhandbuch

2.7 Syntaxdefinition

Bartels AutoEngineer® Dokumentation

Nachfolgend ist die Definition der User Language-Syntax in BNF(Backus-Naur-Form)-ähnlicher Notation aufgelistet. Kommentare sind dabei durch /* und */ begrenzt. Der Doppelpunkt (:) entspricht einem Zuweisungs-Operator und ist folglich zu lesen als "besteht aus". Das Zeichen | kennzeichnet Alternativen. Identifier werden durch das Symbol IDENT, Konstanten durch NUMBER (numerisch), SQSTR (Zeichen) und DQSTR (Zeichenkette) gekennzeichnet. Das Symbol EOLN definiert das Zeilenende. Die Terminalzeichen-Sequenzen (also die reservierten Worte und Operatoren) sind fett gedruckt dargestellt.

/* 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 Dokumentation :: User Language Programmierhandbuch :: Sprachbeschreibung :: Syntaxdefinition

Syntaxdefinition
© 1985-2024 Oliver Bartels F+E • Aktualisiert: 11. October 2010, 10:48 [UTC]

© 1985-2024 Oliver Bartels F+E Bartels Startseite Kontakt und Impressum

Webentwicklung Baumeister Mediasoft Engineering

Syntaxdefinition - Deutsche Version Syntax Definition - English Version