Textbook Notes (368,460)
Canada (161,892)
CS 135 (5)

Module 3 - Syntax and Semantics.docx

2 Pages
Unlock Document

Computer Science
CS 135
Sandy Graham

Syntax and Semantics - A program has a precise meaning and effect. - A model of a programming language provides a way of describing the meaning of a program. - Typically, this is done informally, by examples. - With Scheme, we can do better. Advantages of Modeling in Scheme - There are few language constructs, making the model descriptions short. - No more than the language itself is necessary. (i.e. No need for diagrams, etc.) Spelling Rules for Beginning Student - Identifiers are the names of constants, parameters, and user-defined functions. - Identifiers must contain at least one non-number and may not contain any spaces or these: ( ) , ; , - * + ‘ “. - There are rules for numbers (integers, rationals, and decimals). - Built-in constants such as true and false also exist. Syntax and Grammar - There are 3 problems to address: Syntax: The way in which one is allowed to say something. ?pie like do you Semantics: The meaning of what we say. Boots fly hungrily Ambiguity: A valid sentence has only 1 meaning. Jameson was given a book by June - Grammars enforce syntax and help to avoid ambiguity. - This is similar to the grammar found in spoken languages. Semantic Model - The issue of semantics can be solved using a semantics model of a programming language. - The semantics model provides the method of predicting the result of running a program. - The model
More Less

Related notes for CS 135

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.