Published onAugust 9, 2022Defining languages with sets - A horrible yet correct alternative to grammarsgrammarsformal-languagesstandaloneGrammars define a language, and a language is a set of strings... So is it possible to define a language by directly defining the set? Somehow it is
Published onJune 12, 2022NFA vs DFA - Building a Regex Engine Part 10regex-engineregexformal-languagesWith all the features of the engine finished the only question left is, what would have changed if instead of a NFA engine we had made a DFA engine?
Published onMay 28, 2022Backreferences - Building a Regex Engine Part 9regex-engineregexformal-languagesBackreferences match the same text captured by a previous capturing group. To implement them, we need to evolve the concept of matchers/transitions.
Published onMay 14, 2022Atomic groups - Building a Regex Engine Part 8regex-engineregexformal-languagesAtomic groups can be used to avoid unnecessary backtracking and optimize regex. In this post we explain them in detail and add them to the engine
Published onApril 30, 2022Finding multiple matches - Building a Regex Engine Part 7regex-engineregexformal-languagesWe finally modernize the interface of the regex to allow searching for multiple matches
Published onApril 16, 2022Anchors and multiline mode - Building a Regex Engine Part 6regex-engineregexformal-languagesThe start and end of string anchors (^$) allow to check that a string starts or ends in some way. We'll implement this and in the process add the first regex mode: multiline
Published onApril 2, 2022Character classes and escape characters - Building a Regex Engine Part 5regex-engineregexformal-languagesWith character classes you can test if a character is inside a certain set of symbols. This makes regex simpler and more expressive
Published onMarch 10, 2022Adding capturing groups - Building a Regex Engine Part 4regex-engineregexformal-languagesA formal regex engine is cool but kind of useless. The first step to improve it is to implement capturing groups
Published onFebruary 22, 2022Creating a NFA from a regex - Building a Regex Engine Part 3regex-engineregexformal-languagesWe complete the engine for formal regex by translating a regex engine to a NFA
Published onFebruary 3, 2022Implementing a NFA - Building a Regex Engine Part 2regex-engineregexformal-languagesLet's talk about exacly what's a finite automata, its two types (DFA and NFA), and how to implement a NFA
Published onJanuary 22, 2022Building a Regex Engine Part 1 - Introductionregex-engineregexformal-languagesJust enough information about formal language theory to answer "What is really a regex?" and "How are they executed?"