Saturday, March 19, 2011

Three extension are common to most EBNFs

The first extension denotes an optional part of a RHS, which is delimited by brackets. For example:

<if_stmt> -> if ( <expr> ) stmt [ else <stmt> ]

The second extension is the use of braces in an RHS to indicate that the enclosed part can be repeated indefinitely or left out altogether. For example:



<ident_list> -> ident {, <ident> } 


The third extension deals with multiple choice options. For example:



<term> -> <term> ( *|/|% ) <factor>


Three extension are common to most EBNFs

  • The first extension denotes an optional part of a RHS, which is delimited by brackets. For example:   -> if ( ) statement [ else ]
  • The second extension is the use of braces in an RHS to indicate that the enclosed part can be repeated indefinitely or left out altogether. For example:  -> identifier {, }
  • The third extension deals with multiple choice options. For example:  -> term ( *| / | % )

Distinguish between static and dynamic semantics

  • Static semantic of a language is only indirectly related to the meaning of program during execution; rather it has to do with the legal forms of programs (syntax rather than semantics). Many static semantic rules of a language state its type constraints. Static semantics is so named because the analysis is required to check these specification can be done at compile time.
  • Dynamic semantics is the meaning of the expression, statements, and program units of a programming language.
Generally speaking, dynamic semantics are defined during execution time and can be change while static semantics are known at compile time and do not change.