Basic regular Expression Rules Three operations Choice, concatenation, repetition Equal sign represents the definition of a name for a regular expression, Name was written in italics to distinguish it from a sequence of actual characters
Basic Regular Expression Rules • Three operations: – Choice, concatenation, repetition • Equal sign represents the definition of a name for a regular expression; • Name was written in italics to distinguish it from a sequence of actual characters
Grammars rules Vertical bar appears as meta-symbol for choice Concatenation is used as a standard operation No meta-symbol for repetition Clike the of regular expressions) Use the arrow symbol >instead of equality to express the definitions of names Names are written in italic( in a different font
Grammars Rules • Vertical bar appears as meta-symbol for choice. • Concatenation is used as a standard operation. • No meta-symbol for repetition (like the * of regular expressions) • Use the arrow symbol → instead of equality to express the definitions of names • Names are written in italic( in a different font)
Grammars rules Grammar rules use regular expressions as components The notation was developed by john Backus and adapted by Peter Naur for the Algol60 report Grammar rules in this form are usually said to be in backus-Naur form or bne
Grammars Rules • Grammar rules use regular expressions as components • The notation was developed by John Backus and adapted by Peter Naur for the Algol60 report • Grammar rules in this form are usually said to be in Backus-Naur form, or BNF
3.2.2 Specification of Context Free Grammar rules
3.2.2 Specification of ContextFree Grammar Rules
Symbols of Grammar rules Grammar rules are defined over an alphabet, or set of symbols The symbols are tokens representing strings of characters Using the regular expressions to represent the tokens a token is a fixed symbol, as in the reserved word while or the special symbols such as + or: = write the string itself in the code font used in Chapter 2 Tokens such as identifiers and numbers, representing more than one string, use code font in italics, just as though the token is a name for a regular expression
Symbols of Grammar Rules • Grammar rules are defined over an alphabet, or set of symbols. – The symbols are tokens representing strings of characters • Using the regular expressions to represent the tokens – A token is a fixed symbol, as in the reserved word while or the special symbols such as + or :=, write the string itself in the code font used in Chapter 2 – Tokens such as identifiers and numbers, representing more than one string, use code font in italics, just as though the token is a name for a regular expression