Part 7: The Backtracking System

In this article, we will complete our regex engine with the backtracking system. …

Part 6: the engine

It is finally time to write about the engine of the regex engine we’re building.

As we already saw, the parser produces an AST as a result of the parsing of a regular expression.
Now, the engine has to check whether a given string matches or not a regex.
To do…

Part 5: Parser conclusion

In this article, we’ll dig rapidly through the code of the parser, which will produce the AST we discussed in the previous article in output.

This will hopefully be the last piece about the parser, and then we’ll move on to the engine and the juicy part, the backtracking system.

Part 4: The AST

In this article, I will present you the process I followed to end up with the final AST of the solution, and which are its strength and flaws (because yes, following my articles you won’t create a perfect solution, sorry).

So, let’s start with the logic blocks I wanted to…

Part 3: TDRDP

In the previous articles we spoke about how to define our grammar, how to build the lexer, and a bit about Python strings.

In this article, we will finally begin the parser, the second-hardest part of the project (the first is the engine).


TDRDP stands for Top-Down Recursive Descent Parsing…

Part 2.1: Python strings


Previous episodes recap:

  • We want to build a RegEx Engine.
  • In the first episode we briefly spoke about the grammar we want to recognize.
  • In the second episode we built the lexer (the first of three components we need, the others are the parser, and finally the engine).

This episode…

Part 2: The Lexer

This is the second part of my series of articles on how to write a regex engine in Python. In this article, we’re going to set up the environment and build the lexer.

In the previous article, we spoke about grammar and what we need to complete this project.


Part 1: The Grammar. Building a Regular Expressions Engine Complete With All The Major Features.

In this series of articles, we will follow the steps to build a RegEx Engine in Python. I chose Python over the many alternatives for a few reasons:

  1. It is well integrated with the Linux command line
  2. Because yes.

In a way, I find Python to be a “less verbose…

A beginner-friendly introduction to cybersecurity fundamental principles

The CIA triad is a widely used acronym in information security standing for:

  • Confidentiality
  • Integrity
  • Availability.

These three are the fundamental properties of information to protect.

Thinking about these three when designing for security is crucial to build a robust system.

Let’s briefly analyze them in the order proposed by…


How much a byte really cost?
The question is detrimental, paralyzin’ my thoughts.

You may be wondering what’s the topic of this article. Perhaps you spotted the reference to Kendrick Lamar’s How Much A Dollar Cost.
So, what do Kendrick’s song and bytes have in common? Nothing, to be honest.

This whole article’s a mere storytelling experiment. …

Lorenzo Felletti

Computer Engineering student at the University of Bologna

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store