0% found this document useful (0 votes)
51 views3 pages

Programming Language Concepts Format: 1 Exam Review

This document provides information about an exam for a programming language concepts course, including: - The exam will take place on February 16th from 7-8pm Eastern Time and be canvas-based with one question shown at a time. - The exam is closed book, notes are not allowed, and communication with others is prohibited during the exam. - The exam will include true/false, multiple choice, short answer, and version of homework problems. Question types will assess the ability to read and write small programs. - The February 16th class is cancelled and the instructor will instead hold office hours during that time from 12:20-2:20pm.

Uploaded by

Aniket
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views3 pages

Programming Language Concepts Format: 1 Exam Review

This document provides information about an exam for a programming language concepts course, including: - The exam will take place on February 16th from 7-8pm Eastern Time and be canvas-based with one question shown at a time. - The exam is closed book, notes are not allowed, and communication with others is prohibited during the exam. - The exam will include true/false, multiple choice, short answer, and version of homework problems. Question types will assess the ability to read and write small programs. - The February 16th class is cancelled and the instructor will instead hold office hours during that time from 12:20-2:20pm.

Uploaded by

Aniket
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS 461

Format
Programming Language
Concepts Exam Time
• Feb 16th, 7-8pm US Eastern Time (60 minutes)
Canvas-based exam
• You will be shown one question at a time
Gary Tan • Can go forward/backward to next/previous question
Computer Science and Engineering • IMPORTANT: you can submit your exam only once
Penn State University – DO NOT PRESS the “SUBMIT QUIZ” button until you are
done

•1 •2

Format
Next for moving
to the next 60-min exam
question
• Closed book and notes
• Not allowed to communicate with other students
during the exam
• Questions during the exam can be posted to
campuswire
Submit Quiz for – make them viewable only to instructors and TAs
submitting the – phrase the question to make it easily understandable
entire exam (can be Feb 16th class cancelled
done only once)
• Instead, I will move my office hours this week to the
16th class time: 12:20 to 2:20pm

•3 •4

Types of Questions
True/false questions
Multiple-choice questions
Short answer questions
Versions of homework problems
You will be expected to be able to read and
write small programs
1ST EXAM REVIEW

•5 •6

1
Ch1 Introduction Ch2 Grammar
Language = syntax + semantics + philosophy BNF grammar (CFG)
Programming paradigms • Terminals, nonterminals, production rules, start
• Imperative programming, OO, functional symbol
programming, logic programming • Derivation, left-most vs. right-most derivations, parse
tree
Possible kinds of questions
• True/false questions; multiple-choice questions
Ambiguity
• Definition
You do not need to know
• Removing operator ambiguity
• Date when a language was designed
– Adding explicit parenthesis
– Design a new grammar to enforce associativity and
precedence rules
– Ambiguous grammar + informal spec. of associativity and
precedence rules

•7 •8

Ch2 Grammar Ch2 Lexical and Syntactic Analysis

E-BNF Goal: algorithms for constructing a parse tree


• Writing more concise grammars from input based on grammars
• Alternatives, repetitions, optional parts
Lexical vs. syntactic analysis
• E-BNF is no more expressive than BNF
• Lexical analysis: seq of chars to seq of tokens;
– Can always convert E-BNF to BNF
guided by regular expressions
Possible questions
• syntactic analysis: seq of tokens to parse trees;
• Given a grammar, write derivations and parse trees
guided by CFG
• Conversion from E-BNF to BNF
• Design new BNF grammars
– E.g., given associativity and precedence
• Decide whether a grammar is ambiguous and explain why
• Remove ambiguity

•9 •10

Ch2 Lexical and Syntactic Analysis Ch2 Lexical and Syntactic Analysis
Regular expressions
• epsilon, a, rs, r|s, r* Possible kinds of questions
• extended regular expressions
– r+, r?, [a-z]
• Write regular expressions for syntax of tokens
FSA • Given a regular expression, develop an FSA/DFA
• states, input alphabet, transition function
• accepting an input • Conversion form extended regular expressions to
• deterministic FSA vs. nondeterministic FSA regular expressions
• Theorem: each RE corresponds to a deterministic FSA
The construction of lexers • Write pseudo code for recursive descent parsers,
• a single FSA for all tokens; nextToken() given a grammar
The construction of parsers: recursive-descent parsing
• Limitation: left recursion
• Left-recursion removal
• Left-recursion removal
Lexer and parser generators

•11 •12

2
Ch3 Names, Scopes and Bindings Ch3 Names, Scopes and Bindings
Syntactic issues for Naming Static scoping vs. dynamic scoping
• lexical rules
Binding: compile time vs. runtime • Algorithm based on stack of dictionaries
Variable Possible kinds of questions
• common bindings; naming convention
• l-values vs. r-values
• Scoping
Scope: decides when a name is visible
• nested scopes
• “holes” in scopes
• scope not the same as lifetime
Constructs that can introduce a scope
• Blocks, functions, for-loops, classes, packages (module),
namespace

•13 •14

Comparing the syntax of E-BNF Comparing the syntax of E-BNF


and Regexps and Regexps
They have similar concepts but with different Regexps
syntax • Alternation: r1 | r2
E-BNF • 0-or-more repetition: r*
• Alternative parts in parentheses and separated with • Optional: r?
vertical bars • …
– <exp> -> <exp> (+ | -) <exp>
• 0-or-more repetitions in curly braces { }
– <num> -> <digit> {<digit>}
• Optional parts in square brackets [ ]
– <if-stmt> -> if <test> then <stmt> [else <stmt>]

•15 •16

You might also like