Let's build a printf! Episode n° 1 : Format parser

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

ความคิดเห็น • 14

  • @otetumooluwaseun3948
    @otetumooluwaseun3948 ปีที่แล้ว +9

    Explaining how printf works with those flags and precisions in the introductory part is a great step to writing a custom printf.
    Thank you for doing this.
    Hope to see your work on Shell.

    • @onaecO
      @onaecO  ปีที่แล้ว +1

      Ty! for the shell I think I'll do, even though it's a totally different beast to tame 😂

  • @peternzioki4555
    @peternzioki4555 ปีที่แล้ว +3

    video is lit. excellent work. just wow. greetings from Nairobi, Kenya.

    • @onaecO
      @onaecO  ปีที่แล้ว

      Ty bro always kind words from u ❤️🫡

  • @repario2008
    @repario2008 หลายเดือนก่อน +1

    this code is more complicated than it should be, in my humble opinion. Great work though. Keep posting dude.

    • @onaecO
      @onaecO  หลายเดือนก่อน

      I Agree 😄

  • @stefanodipuma6552
    @stefanodipuma6552 ปีที่แล้ว +1

    dude fenomenal as always. Its fantastic that I started doing printf and 2 hours later you posted the first printf video...

  • @ThePolbruc
    @ThePolbruc ปีที่แล้ว

    this format of live coding helps a lot thank you

  • @dayoluk
    @dayoluk 3 หลายเดือนก่อน

    "The `%` symbol was chosen historically and is somewhat arbitrary, but here’s why it likely became the standard:
    1. **Symbol Clarity**: `%` wasn't already widely used for other purposes in strings or C syntax, making it a suitable candidate to indicate "format specifier" without conflicting with common programming symbols like `#`, `&`, or `$`.
    2. **Semantic Fit**: `%` is often associated with "percent" or "portion," which can suggest that something will be inserted or substituted in place of it, as in placeholders. Other symbols (like `#` or `&`) don’t carry this implication as intuitively.
    3. **Historical Conventions**: Early programming languages (like Fortran and BASIC) influenced C's design, and `%` was sometimes already associated with formatting or placeholders in these languages. Since C was designed in the early '70s when conventions were forming, the `%` symbol stuck, setting a standard that carried forward into other languages influenced by C.
    In short, `%` won out partly by convention, partly by availability, and partly because it hinted at substitution or placement in a way other symbols didn’t quite match!"
    thx chatGPT!

  • @alesusraes0816
    @alesusraes0816 2 หลายเดือนก่อน

    I'm making a C compiler from C++ and I have a problem:
    If I need parse this kind of lines of code: printf("%d
    ", x);
    When the Token *Scanner::nextToken() recognize each token that found, immediately after printf( ,
    I mean, I see in terminal:
    TOKEN(PRINTF)
    TOKEN(L_PAR)
    And the program finish.
    How Can i do to recognize the next "string" "%d
    " , x);
    And then generate:
    TOKEN(PRINTF)
    TOKEN(L_PAR)
    TOKEN(STRING_LITERAL, %d
    )
    TOKEN(COMMA)
    TOKEN(ID, x)
    TOKEN(R_PAR)
    TOKEN(SEMICOLON)

  • @its_code
    @its_code ปีที่แล้ว +1

    ❤❤❤❤😊wowow

    • @onaecO
      @onaecO  ปีที่แล้ว

      🫡❤️

  • @konstantinrebrov675
    @konstantinrebrov675 ปีที่แล้ว

    Are you Italian?

    • @onaecO
      @onaecO  ปีที่แล้ว

      yep! 🇮🇹