Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Python Midterm Exam: Semantics and Syntax of Types and Operators, Exams of Electrical and Electronics Engineering

The take-home midterm exam for the course 'types and programming languages' taught by professor jeremy siek. The exam focuses on writing a small-step semantics for a subset of python using evaluation contexts, as well as defining an abstract syntax for the language if desired. Students are encouraged to use the python documentation and standard interpreter for reference.

Typology: Exams

Pre 2010

Uploaded on 02/10/2009

koofers-user-q6k-1
koofers-user-q6k-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Python Midterm Exam: Semantics and Syntax of Types and Operators and more Exams Electrical and Electronics Engineering in PDF only on Docsity! Types and Programming Languages Professor Jeremy Siek Take Home Midterm Exam Due March 4, 2007 Name: 1. Write a small-step semantics for the subset of Python described below. Use evaluation contexts. Refer to the Python web site for documentation regarding the language. You may also use the standard Python interpreter to check your ideas regarding the semantics of the language. If you wish, you may define an abstract syntax for this subset of python instead of using the below concrete syntax. identifier ::= # see the Python Reference Manual unary_op ::= "+" | "-" | "not" binary_op ::= "+" | "-" | "*" | "/" | "%" | "**" | "<" | ">" | "==" | ">=" | "<=" | "!=" | "or" | "and" expression ::= identifier | integer # see the Python Reference Manual | unary_op expression | expression binary_op expression | "(" expression ")" | "True" | "False" | expression "if" expression "else" expression simple_statement ::= "pass" | identifier "=" expression | expression compound_statement ::= "if" expression ":" suite "else" ":" suite | "while" expression ":" suite stmt_list ::= simple_stmt (";" simple_stmt)* [";"] statement ::= stmt_list NEWLINE | compound_stmt suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved