- Set of words
- Syntax - rules for putting words together
- Semantics - meaning
- Syntax - correct
- Semantics - incorrect
- Alphabet
- Syntax
- No semantics
Meta Language (rules of formal language) comprises of:
- Regular Expressions
- Backus-Naur Form
Regular Expression - describes valid strings in a formal language
Example:
a(a│b)*
│ = or * = Zero or more occurences
Valid a aa aabab
Invalid b ba abc
* - Zero or More a*
│ - Or a│b
+ - One or More a+
? – Zero or One aab?
More notation (meta characters):
( ) - Brackets
[ ] - Alternate OR [ab]
- - Sequence a-z
^ - Not ^t
\ - Escape Meta Meaning or Shorthand Classes
. - Wildcard Character
Backus-Naur Form - notation for expressing the rules for constructing valid strings in a regular language.
No comments:
Post a Comment