Coding a regex engine from scratch with no imports in Python! (From Scratch #1)

Sdílet
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

Komentáře • 11

  • @usingvancedplzdontban1128

    Amazing work brother 🙌

  • @tonystarc9567
    @tonystarc9567 Před 3 lety +2

    Brother please keep posting such project videos... These are very useful. Thank you.

  • @lautenschlager4406
    @lautenschlager4406 Před rokem +2

    How do you not have a thousand times more subscribers here? This is just high quality content.

  • @Max-my6rk
    @Max-my6rk Před 2 lety +2

    omg this is exactly what I am looking for omg!

  • @dreadesina5216
    @dreadesina5216 Před 3 lety +1

    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

  • @anshshukla162
    @anshshukla162 Před 4 lety +2

    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?

    • @clumsycomputer
      @clumsycomputer  Před 4 lety +3

      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

    • @anshshukla162
      @anshshukla162 Před 4 lety +1

      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)".

    • @clumsycomputer
      @clumsycomputer  Před 4 lety +3

      @@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.

  • @Yotanido
    @Yotanido Před 2 lety +1

    The (mis)use of lists instead of tuples irks me