Reading 12: Regular Expressions & Grammars
Some program modules take input or produce output in the form of a sequence of bytes or a sequence of characters, which is called a string when it’s simply stored in memory, or a stream when it flows into or out of a module. Much like the methods we’ve been developing that have multiple clients and implementations, there are many different users depending on a shared understanding of what format these strings or streams take; in otherwords, a specification is needed for these sequences. In today’s reading, we talk about how to write a specification for such a sequence. Concretely, a sequence of bytes or characters might be: For these kinds of sequences, we introduce the notion of a grammar, which allows us not only to distinguish between legal and illegal sequences, but also to parse a sequence into a data structure that a program can work with. The data structure produced from a grammar will often be a recursive data type like we talked about in the recursive data types reading. We al
Reading 12: Regular Expressions & Grammars Reading 12: Regular Expressions & Grammars Software in 6.102 Safe from bugs Easy to understand Ready for change Correct today and correct in the unknown future. Communicating clearly with future programmers, including future you. Designed to accommodate change without rewriting. Objectives After today’s class, you should: Understand the ideas of grammar productions and regular expression operators Be able to read a grammar or regular expression and determine whether it matches a sequence of characters Be able to write a grammar or regular expression t
Explore this link on the map →saved by
related reading
- Problem Set 3: Memelyweb.mit.edu
- Reading 18: Regular Expressions & Grammarsweb.mit.edu
- Reading 19: Little Languagesweb.mit.edu
- Reading 19: Parsersweb.mit.edu
- Laurence Tratt: Which Parsing Approach?tratt.net
- Parsing Expressions · Crafting Interpreterscraftinginterpreters.com
- Regular expression - Wikipediaen.wikipedia.org
- Representing Code · Crafting Interpreterscraftinginterpreters.com
- Regular expression HOWTO — Python 3.14.6 documentationdocs.python.org
- 2. Kaleidoscope: Implementing a Parser and AST — LLVM 23.0.0git documentationllvm.org
- Chomsky hierarchy - Wikipediaen.wikipedia.org
- Pratt Parsers: Expression Parsing Made Easy - journal.stuffwithstuff.comjournal.stuffwithstuff.com