Download presentation
Presentation is loading. Please wait.
1
Method of Language Definition
A Language is defined by: A: Lexical = Valid Tokens & Words B: Syntax = The GRAMMER of the Language C: Semantics = The MEANING of valid syntactical statement Language
2
26 letter and . ? ! Special Characters
The Valid Tokens create “Words” - Expression then become Written English 26 letter and . ? ! Special Characters Words Obj of Preposition Verb Clause Sentences Statement – Complete Statement Rules – Spelling of Words – Completing a sentence What is part A: Lexical? What is part B: Syntax?
3
26 letter and . ? ! Special Characters
The Valid Tokens “a, e, h, H, i, J, m, n, o, s, y” create “Hi, John, name, my, is” “Words” - Expression then become “Hi, my name is John” Written English 26 letter and . ? ! Special Characters Words Obj of Preposition Verb Clause Sentences Statement – Complete Statement Rules – Spelling of Words – Completing a sentence What is part A: Lexical? What is part B: Syntax?
4
C. Semantics Semantics Meaning of a valid syntactical statement
Context free Context sensitive
5
Let’s Study language First, let’s look at a programming language Java
A: Syntax Valid Token Alphabet & Spec. Char Words Class, Private, Public Statement – if (A < B) {B = A;}
6
Syntax Graph
7
Let’s look at another programming language
A Language is defined <N, T, S, P> where T is a finite set of terminal symbols, N is a finite set of non-terminal symbols, S is the start symbol, S, P is a finite set of production rules of the form, Let’s see the grammar of Arithmetic expressions in the next slide.
8
Language is defined <N, T, S, P> where
N= Non-terminal symbols: <Exp>, <Term>, <Factor> T= Terminal symbols: +, -, *, /, (, ), x, y, z, ... S= Start symbol: <Exp> P= Production rules: <Exp> ::= <Exp> + <Term> | <Exp> - <Term> | <Term> <Term> ::= <Term> * <Factor> | <Term> / <Factor> | <Factor> <Factor> ::= x | y | ... | ( <Exp> ) | - <Factor> A grammar for the concrete syntax of simple arithmetic expressions
9
Semantics “The MEANING of a correct …
If A + 2 > B then A = 10; Logic that decomposes to “machine activity” Register ACU
10
Think! Possible expressions: Registering Log in Search Find home
Your Project Possible expressions: Registering Log in Search Find home For Log in Mouse Travel define : 1) Tokens = Mouse Selection Ind. on screen Obj. Mult. On screen Obj. valid expressions Words Define criteria
11
Possible tokens in your interaction Language
MT : Mouse Travel MS: Mouse Selection – indicate the on screen object Mult: Multiple Selection multiple screen objects selected Alph + Specific (except + ENTER TAB) S: String
12
Example Goal - Login A valid syntactical login:
MT => Click when on B1 => Type “bernal” => Tab => Type “SHhh” => Enter P1 B1 B2 B3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.