Coding a regex engine from scratch with no imports in Python! (From Scratch #1)
Vložit
- čas přidán 29. 06. 2020
- In this video, we build a full-featured regex engine from scratch in Python with no imports! This was streamed live on / clumsycomputer on 2020/06/29.
The full code including more details is available at git.sr.ht/~vladh/clumsycomput...
Because this is a recording of a live stream, you'll hear me sometimes talking to the chat.
This first clumsy computer video is only 720p, so it could look a bit better - sorry, I was still figuring the quality settings out.
If you'd like to see more, please follow the clumsy computer Twitch channel at / clumsycomputer .
If you have any questions, write a comment or contact me on / clumsycomputer .
What would you like to see me code from scratch next? Let me know in the comments! :)
Wishing you a swell day,
Vlad - Věda a technologie
Amazing work brother 🙌
Thank you! :)
Brother please keep posting such project videos... These are very useful. Thank you.
How do you not have a thousand times more subscribers here? This is just high quality content.
omg this is exactly what I am looking for omg!
I stole the key-binding from your dotfiles. Really cool, I had one that take me out of Vim and back after execution but this was nifty. Thanks
Unless I'm missing something, can't an NFA evaluate a regex with a known, fixed number of parentheses, e.g. the (a) example at 5:26?
Hey Ansh,
Good question! Balanced parentheses can't be matched by a regular finite state machine, because it can't remember state, it only evaluates one term at a time. If you want to do this with an NFA though, you can use a pushdown automaton, which basically additionally also keeps a stack for these kinds of terms.
Here's an article with more details! raganwald.com/2019/02/14/i-love-programming-and-programmers.html
Have a nice day,
Vlad
Balanced parentheses can't, I agree, but the description in the video seemed to not distinguish that from "a known, fixed number of parentheses" if I understand the segment correctly. (start) - ( > (1) - a > (2) - ) > (end) would match "(a)".
@@anshshukla162 Ah, I understand what you meant! Of course, there's no problem with matching the parenthesis character like any other character. The problem is when parentheses need to be balanced, which is usually the case.
The (mis)use of lists instead of tuples irks me