CSCI325 Concepts of Programming Languages Dr Ahmed Rafea 1
Chapter 4
Syntax - the form or structure of the expressions, statements, and program units Semantics - the meaning of the expressions, statements, and program units
Who must use language definitions?
- 1. Other language designers
- 2. Implementors
- 3. Programmers (the users of the language)
Lexical Structure of Programming Languages
- A language is a set of sentences
- A sentence is a set of lexemes
- A lexeme is a set of character (e.g., *, sum, begin)
- A token is a category of lexemes
- Reserved word or keyword such as if, while..
- Literal or constants such as 23 (numeric
literal)), “hello” (a string literal)
- Special symbols such as “;”,” <“,…
- identifier