CMSI 3802
Quiz 6 Preparation

When

Last 10 minutes of class on Wednesday, April 15, 2026.

Everyone takes the exam at the same time.

Scope

Syntax, Regular Expressions, Parsing Theory.

Ground Rules

You will take the exam on Brightspace. There is 10 minute time limit, or 15 minutes for those with time-and-a-half accommodations.

Preparation Checklist

Do each of the following to maximize your preparation:

Were you able to check off every box?

Outline of Course Content

The fact that active recall is better for acquiring long-term knowledge does not mean that outlines and concept maps are not useful. Learners should use multiple techniques—think “both and” rather than “either or.”

Syntax
    Motivation (there is a structure underlying all programs)
    Many ways to express this structure as a string
    Definition of Syntax
    Syntax Diagrams
    Lexical vs. Phrase Syntax
        Why this is massively important
        Ways to represent the difference
    Tokens
    Parse Trees
        The frontier of the parse tree is the token stream
    Dealing with Ambiguity
        Precedence (and how to capture it in a grammar)
        Associativity (and how to capture it in a grammar)
    Parsing (sneak peek only)
        Hand-crafted, recursive descent
        Parser generators
        Analytic Grammars
        PEGs
        Ohm
    The Problem of Context
        Things you cannot capture in a context-free grammar, incomplete list:
            No redeclare within scope
            No use of possibly uninitialized variables
            Type checking
            Correct number of arguments must appear in a call
            Access modifiers must be correct
            All execution paths through a function must end in a return
            All abstract methods must be implemented or declared abstract
            All declared local variables must be used
            All private methods in a class must be used
        Is this stuff syntax or semantics?
            People can disagree
        Side note: can be formalized in theory but why bother
    Type inference
    Abstract Syntax
        What ASTs look Like
        Difference between CSTs (Parse trees) and ASTs
        Tree grammars to formally define ASTs
        Esprima
        Examples in JavaScript
        Examples in Java
    Different syntax formalisms in the real world
Parsing Theory
    What is parsing?
    Lexical vs Syntactic parsing
    Approaches to parsing
        Top-down, LL, Expand-Match
        Bottom-up, LR, Shift-Reduce
    Recursive Descent
    Analytic Grammars
    PEGs
Regular Expressions
    In theory (type-3)
    In practice
        Common notation for Regexes in modern languages
        (   )   [   ]  {   }   ^   $   .   \   ?   *   +   |
        Uses: validation, search, extraction, replace
        Groups
        Quantifiers
            Eager: * + ? {}
            Reluctant: *? +? ?? {}?
            Possessive: *+ ++ ?+ {}+
        Backreferences  \1 \2 ...
        Anchors: ^ $ \A \Z \b \B
        Lookarounds: ?= ?! ?<= ?<!
        Performance concerns

About the Problems

This is a mini-quiz which tests for immediate understanding of topics and not your ability to work out problems over an extended duration of time. There is a strict time limit so that your immediate fluency is tested rather than your ability to search the web (or worse, ask a chatbot), since these things take time. There will be 5–10 questions, some will be multiple choice, some multi-select, and some matching. There are no free-form answers, so the exam will be autograded and you will see your score immediately after it is submitted.

All content on the assigned readings is fair game for questions, so do not neglect the readings, and by all means do the recall questions!