Code Review: Holy C Lexer

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025

Комментарии • 217

  • @tedchirvasiu
    @tedchirvasiu Год назад +912

    "I'm a white man, I write my own compiler"

    • @beamshooter
      @beamshooter Год назад +110

      he actually said this, didn't he

    • @tedchirvasiu
      @tedchirvasiu Год назад +1

      @@beamshooter Yeah, look for "Terry Davis gets a phonecall".

    • @Shitopia539
      @Shitopia539 Год назад +93

      legend

    • @STUIPEDCHICKEN
      @STUIPEDCHICKEN Год назад +103

      chad

    • @JohnSmith-ox3gy
      @JohnSmith-ox3gy 11 месяцев назад +40

      Neither of the statements aren't wrong tho.

  • @larryluck7305
    @larryluck7305 Год назад +569

    RIP Terry A Davis 🙏

    • @DarkerCry
      @DarkerCry Год назад +39

      Such a tragic story, the guy was truly amazing

    • @shojauddin2509
      @shojauddin2509 Год назад +4

      @@DarkerCry he was genius but he wasn't that amazing as a person, he said lots of racist stuff in his times

    • @DarkerCry
      @DarkerCry Год назад +36

      @@shojauddin2509 lol

    • @leaveleague3491
      @leaveleague3491 Год назад +19

      @@shojauddin2509 still a genius

    • @mr.billthrower7392
      @mr.billthrower7392 Год назад +1

      @@shojauddin2509 You do know that the nigga had schizophrenia right...

  • @johanngambolputty5351
    @johanngambolputty5351 Год назад +303

    In unholy c, you have to tip your fedora to get any memory... m'alloc

  • @simonfarre4907
    @simonfarre4907 Год назад +241

    2:05 - you guys say "the way its laid out now is bad". How so? I think you probably didn't think this through. A pointer to U8 is not byte sized. It is, 32 or 64 bits depending on the platform. Its kinda funny that you both say "it's categorically bad". Codefluencers do what codefluencers do 😊

    • @orbital1337
      @orbital1337 Год назад +20

      They didn't see the pointer - that shitty C syntax of putting the pointer on the identifier instead of on the type is to blame. The variable declaration syntax in C is such a horribly messed up disaster.

    • @simonfarre4907
      @simonfarre4907 Год назад +3

      @@orbital1337 it is on the type though; but I think I get what you mean. You want *u8 instead of u8*.

    • @orbital1337
      @orbital1337 Год назад +18

      @@simonfarre4907 No, in C and C++ (and presumably Holy C) the * does not go on the type. For example, you can write "int *x, y, *z;" and this declares an int pointer x, an int y (!) and another int pointer z. This is a very useful feature of C if you hate your colleagues and/or want to increase your job security by making your code less readable. Like seriously, who thought that was a good idea?
      Anyways, in the code in the example, this style is used so the first variable is declared as "U8 *input" instead of "U8* input". With the way the text is aligned, that makes it look like the types are U8, U64, U64, U64, U8 if you're just skimming over the code.

    • @simonfarre4907
      @simonfarre4907 Год назад +1

      @@orbital1337 Yes it does. It depends on how you read them. int a* would have been "not on the type". But following the type, means it's part of the type sequence.
      The rest I certainly agree with. But they did not get it until later in the video.

    • @nameq
      @nameq Год назад +17

      not the only mistake they made

  • @angelcaru
    @angelcaru 8 месяцев назад +79

    The title for this is kinda confusing. When I read "Holy C Lexer" I think "the lexer for Holy C", not "some random lexer that happens to be written in HolyC"

    • @dn7949
      @dn7949 Месяц назад +2

      Programmers don't understand the concept of programming. Many such cases.

  • @Endelin
    @Endelin Год назад +97

    I'm going to name my next videogame character Malloc Numerick.

    • @themannyzaur
      @themannyzaur Год назад +10

      Me seeing this some time in the future and just laughing my ass off because I know where it's from 😆

  • @slendi9623
    @slendi9623 Год назад +156

    I love how people got confused by U0, yes HolyC has both I0 and U0. Idk the difference really other than its different types. Also, classes can have at most 1 level of inheritance

    • @RotatingBuffalo
      @RotatingBuffalo Год назад +15

      i'm fairly sure it doesn't have I0, as it would be the same as U0. also I looked it up and have not seen any evidence to the existence of an I0 type.
      regardless, the purpose of the type is the same as "void" in standard C, although sizeof(U0) is 0, and sizeof(void) is 1.

    • @yjlom
      @yjlom Год назад +7

      @@RotatingBuffalo sizeof (void) is implementation defined I'm pretty sure
      edit: actually it must be undefined since pointer arythmetics on void *is illegal outside of GNU extensions

    • @8ightfold
      @8ightfold Год назад +1

      @@yjlom sizeof(void) is nonstandard, not imp defined. It's ill formed, don't use it :P

    • @slendi9623
      @slendi9623 Год назад +9

      @@RotatingBuffalo Both I0 and U0 exist, execute CDoc *doc = DocNew("::/Dump.DD"); Who("m",,,doc); DocWrite(doc); then Ed("::/Dump.DD"); this dumps the hash table and you can then search for I0.

    • @slendi9623
      @slendi9623 Год назад +5

      @@yjlom sizeof(U0) and sizeof(I0) are both 0, sizeof(U64) is 8.

  • @tomkayak9752
    @tomkayak9752 Год назад +48

    Wow, Terry Davis. I did just go down that rabbit hole.

  • @minciNashu
    @minciNashu Год назад +55

    Why the hate for u64 as length? It's equivalent to size_t on 64-bit targets, which is what's used for container size.

    • @mattymerr701
      @mattymerr701 Год назад

      Or uint64_t right?

    • @YourMom-rg5jk
      @YourMom-rg5jk Год назад +27

      people like to over-complicate things. modern software is a god damn clusterfuck

    • @maksymiliank5135
      @maksymiliank5135 Год назад +17

      @@YourMom-rg5jkSounds like something Terry Davis would say

  • @aichrist
    @aichrist Год назад +56

    Rest in Peace Terry! I've been working on a tutorial series. Hopefully more apps in HolyC soon :)

    • @masterchief1520
      @masterchief1520 5 месяцев назад +1

      I see you followed through. Good job.

  • @SimGunther
    @SimGunther Год назад +90

    That case range in the switch statement is one of the MANY things that make it truly "holy" ❤

  • @ghostbusterz
    @ghostbusterz Год назад +56

    2:10 - TempleOS is 64-bit, meaning addresses (pointers) are 8 bytes. Thus, the Lexer class is laid out correctly if the concern is optimal packing.
    8 bytes
    8 bytes
    8 bytes
    8 bytes
    1 byte

  • @Endelin
    @Endelin Год назад +59

    As a kid I thought the word "prevent" meant "to start". So Smokey the Bear's PSA of "Only YOU can prevent forest fires" was super confusing.

  • @kurt7020
    @kurt7020 Год назад +57

    Reminds me of "clang" being pronounced "C-lang". It's called "clang" (like the sound) by the project deveopers.

    • @aasquared8191
      @aasquared8191 Год назад +6

      dude, it's not a holeyck. its definitely holy c.

    • @thego-dev
      @thego-dev Год назад +8

      @@aasquared8191 i think they're talking about the "MAlloc" situation, but okay

    • @astroid-ws4py
      @astroid-ws4py Год назад

      We also have flang.

    • @JafacaksWasTaken
      @JafacaksWasTaken Год назад +3

      its holy c like holy see, the jurisdiciton of the pope

    • @sqlexp
      @sqlexp Год назад

      It should be pronounced as Holy Shee or Holy Chez💩

  • @pubwinner7867
    @pubwinner7867 Год назад +69

    Pseudo intellectuals mocking holy c vibe. i cant keep watching

    • @TheVimeagen
      @TheVimeagen  Год назад +36

      i think calling me a pseudo intellectual is an insult to pseudo intellectuals

    • @LanceWillMakeIt
      @LanceWillMakeIt Год назад +7

      wasn't ready for that 😂@@TheVimeagen

  • @almighty1984
    @almighty1984 Год назад +13

    I remember making Quake maps and not knowing what "nonsolid" meant

  • @anispinner
    @anispinner Год назад +12

    Case range in the switch statement? Holy C... Why the F C didn't have that

    • @JasonMitchellofcompsci
      @JasonMitchellofcompsci 11 месяцев назад +3

      That's what Holy C is. C++ threw the kitchen sink at C. Holy C just added the obvious stuff. Also it can be repl'd.

  • @alkeryn1700
    @alkeryn1700 Год назад +20

    actually you can use the "..." range when using clang, many compiler implement it but it isn't part of the standard !

    • @BanakaiGames
      @BanakaiGames Год назад +8

      It's from gcc, the flag for it in clang is even gnu-case-range

  • @JasonMitchellofcompsci
    @JasonMitchellofcompsci 11 месяцев назад +15

    As for the reason for the U64 instead of U32. Basically the since HolyC is newer than 64 bit processors and it's a fresh start with no historic unix code the idea is there is never a reason for 32 bit anything.
    The whole point of TempleOS is to come in with no standards and start new. This is one of the reasons it doesn't do networking. Then it would have to accept insert random list of RFCs. Nope. It is forbidden to code RFC or ISO anything in TempleOS. Unless you can personally invent it you shouldn't code it.

  • @MACAYCZ
    @MACAYCZ Год назад +6

    5:50 In fact gnu extension added support for that.

  • @u9vata
    @u9vata Год назад +8

    HolyC also have other trickeries that are handy actually...

  • @therealsunnyk
    @therealsunnyk Год назад +8

    "It looks like Go"... err... it looks like C?

  • @cadetsparklez3300
    @cadetsparklez3300 10 месяцев назад +4

    get the word rust off my holy c

  • @ryantylerMachete
    @ryantylerMachete 11 месяцев назад +4

    terry himself referred to it as "malloc" og terminology

  • @onioncontrol
    @onioncontrol Год назад +8

    RIP Terry. I hope I'll get to meet you when I leave this earth. God Bless everyone. If you're schizophrenic please don't let yourself degrade as bad as Terry was twords the end.

  • @deleted-test
    @deleted-test Год назад +10

    i want to make a linux window manager in holyC. i know nothing about holyC. I barely know anything about C.
    i will come back to this comment once i reach my goal, be it months or years.

    • @leehaswell4206
      @leehaswell4206 Год назад +1

      are you there yet

    • @deleted-test
      @deleted-test Год назад

      @@leehaswell4206 bruh i commented 3 days ago and you responded yesterday :skull: no way im that quick

    • @paulmccartney2327
      @paulmccartney2327 Год назад +2

      It's been a long goal of mine to write an interrupt routine in Haskell. Wish me luck guys !!!!!!!!!!!!!!!!!!

    • @LanceWillMakeIt
      @LanceWillMakeIt Год назад +1

      are you there yet

    • @deleted-test
      @deleted-test Год назад

      @@LanceWillMakeIt not yet. :>

  • @theAmazingJunkman
    @theAmazingJunkman 6 месяцев назад +1

    Chat blew up about U0 being used in place of void and they didn’t even notice

  • @zenedge7599
    @zenedge7599 Год назад +5

    R.I.P. Terry A Davis

  • @KadenCartwright
    @KadenCartwright Год назад +6

    Is that TPope in the background 😂💀

  • @asdfasdf9477
    @asdfasdf9477 Год назад +24

    Let’s just pray that MAlloc never fails.

    • @YourMom-rg5jk
      @YourMom-rg5jk Год назад +7

      so don't lean over on a motorcycle

  • @nameq
    @nameq Год назад +38

    honestly impressive how little you know for what and how youre doing

    • @szymoniak75
      @szymoniak75 Год назад +8

      exactly

    • @nameq
      @nameq Год назад +1

      ​@@szymoniak75 peak dunning-kruger codefluencers
      theyre probably not too dumb but the confidence is repulsive

    • @AKA-077
      @AKA-077 Год назад

      what do you mean

    • @The_Conspiracy_Analyst
      @The_Conspiracy_Analyst Год назад +7

      Yeah this is what stood out for me as well

  • @moosethemucha
    @moosethemucha Год назад +5

    I've seen several of these now - whats the context ? What is this code for - is it a coding golf challenge thing ? Who's writing this code for the review ? It took me so long to work who Tom was - he'd know though as he's a genius.

    • @joraquest2306
      @joraquest2306 Год назад +2

      lmao I dont know why they are doing it but the codes are written by viewers

    • @replikvltyoutube3727
      @replikvltyoutube3727 Год назад +9

      I think it's following a book about making parser. It's a thing Primeagen wants to make programming language speed competition with in 'real-ish world' scenario.

    • @reo101
      @reo101 Год назад

      ruclips.net/video/gsrNrlA-dog/видео.html

    • @InvidiousIgnoramus
      @InvidiousIgnoramus Год назад

      @@joraquest2306 I highly doubt Terry A Davis came back from the grave to send his code to these literally whos.

  • @osamaaj
    @osamaaj Год назад +6

    3:33 always make sure malloc returns a valid pointer before proceeding to use it.

    • @TonKcedua
      @TonKcedua Год назад +44

      Actually, in Holy C we use a faith-based system. If you're not a sinner you always get a valid pointer back!

    • @osamaaj
      @osamaaj Год назад +6

      @@TonKcedua my bad. Guess I need to work on my faith 🛐

    • @slendi9623
      @slendi9623 Год назад +4

      templeos is so lightweight, malloc never fails, also throws 'OutMem' if fails

    • @poiu5302
      @poiu5302 10 дней назад

      If it doesn't, you have bigger problems than a crash.

  • @alexanderblohme5044
    @alexanderblohme5044 6 месяцев назад +4

    Doesn’t that dude on the right believe he is a “god” programmer (at least how he talks on his streams) and he didn’t even fcking know malloc was “memory allocation”?😂

    • @XENON2028
      @XENON2028 5 месяцев назад +4

      the only god programmer is terry imo

    • @AndreyMakarov-i7h
      @AndreyMakarov-i7h Месяц назад

      No formal education?

  • @TeH.j0keR
    @TeH.j0keR 4 месяца назад

    I can imagine Lex Fridman writing his own compiler, like a machine.

  • @sixthsurge
    @sixthsurge 8 месяцев назад +2

    everyone knows malloc is short for mallocate

  • @sabbaseleftheriadis5601
    @sabbaseleftheriadis5601 3 месяца назад +1

    only God can criticise Terry's code

  • @distant6606
    @distant6606 Год назад +6

    wheres go 🧐

  • @scrawnydaghost
    @scrawnydaghost Год назад +5

    I have no idea what any of this means but my faith in God has only grown watching it

  • @steveg1961
    @steveg1961 Год назад +7

    I've always pronounced it "MAL-loc." That just seems the right pronunciation. Knowing, of course, it is a memory allocation.

  • @DNA912
    @DNA912 Год назад +2

    have to come clean. I also didn't realise malloc was MAlloc

  • @MsDuketown
    @MsDuketown Год назад +1

    The monkey lexer is a module in the Elixer lib? Which distro are you running?
    Nice feature talkie-talk. Was it about ~100 LoC? A bit tóó bounded for Terry's multi-decade project.
    Looking forward to the next feature. Tokenization compared to TS-Rust-Zig-deez?

  • @georgecop9538
    @georgecop9538 Год назад +6

    Then why is not MemAlloc, to align with MemCpy?

    • @themannyzaur
      @themannyzaur Год назад +4

      To make it easier for C programmers to know which functions to use and such I guess
      So malloc = MAlloc and MemCpy = memcpy

    • @SimonBuchanNz
      @SimonBuchanNz Год назад +5

      Because the original C only looked at the first 6 characters of the name. You could make it longer, but it would ignore anything past that silently.
      Another fun detail is that struct fields were unscoped, so if you had two "name" fields the compiler just picked one of the offsets and used it for any ".name" in the source.
      They *really* believed in "Worse is better" back in the 70s!

    • @aahnecroth
      @aahnecroth Год назад

      because god said "no!"

  • @RandomGeometryDashStuff
    @RandomGeometryDashStuff Год назад +2

    05:39 it's c gnu extension

  • @GerbenWijnja
    @GerbenWijnja 8 месяцев назад

    TempleOS supports images inside text files. Like, you can have an animated gif in your source code file.

  • @m4rt_
    @m4rt_ Год назад +1

    When are you going to review the Jai code?
    I might try to quickly get it done before you review it.

  • @livingfreely
    @livingfreely 7 месяцев назад

    Regarding the spread operator in the switch case:
    Terry Davis was explaining this and said roughly that this is the hardest question in programming to decide if things like these are either "divine intellect or n-word-licious."

    • @masterchief1520
      @masterchief1520 5 месяцев назад +1

      Terry had a way with his words 😂

  • @plagiator19
    @plagiator19 2 месяца назад +1

    I think these guys glow in the dark

  • @anon-fz2bo
    @anon-fz2bo Год назад +1

    suppose the func StrNewN took in a buffer of 3 characters and the size arguement was the length of this buffer.
    that implies that the first line in this function is an array of 4 bytes right? malloc(sz + 1) == malloc(3 + 1) which means allocate 4 bytes in this case from my understanding.
    then copy the contents of the input buffer into the newly created output buffer & null out the final index of that character array effectively making a c string ie a string that ends will a null byte then simply return this string.
    what i dont get is why alloc 4 bytes instead of 3? im assuming the extra byte is used to assign the null byte.
    if output now has a length that is == input and input was an array of the chars "abc" then out[sz] is actually out[3] which hes setting to be equal to '\0'. you would get an indexing error in most languages coz the compiler would say something like index out of bounds in this case but im assuming thats why he allocated 4 bytes instead of 3 for the out buffer?

    • @NoodleFlame
      @NoodleFlame Год назад

      So possibly zero indexing and length variables are causing some confusion here? Following your example:
      If StrNewN took in a buffer of 3 characters and the size argument was the length of this buffer 3 then....
      Yes that does allocate an array that can occupy 4 chars, 3 from the buffer passed in and an additonal char '\0' for the delim. The valid index range being 0..3 inclusive (4 in total).
      If the input was "abc" then after the MemCpy the output would look like this:
      out[0] = 'a'
      out[1] = 'b'
      out[2] = 'c'
      And then it terminates the c string at index sz which we passed in as 3 and because we have extended the array by 1, we know that the previous length is now the maximum valid index.
      out[3] = '\0'
      Hopefully that clears things up a little

    • @maksymiliank5135
      @maksymiliank5135 Год назад

      C represents the string with a zero byte (0x00, '\0') at the end to indicate that it is the last byte of the string (that's why it's called "zero-terminated string"). So If you want to get the length of a string, you have to count the number of bytes until you find zero byte. Usually the zero byte is not counted to the length, but you have to allocate one additional byte in a buffer and set it to 0, because a lot of functions in c expect a zero-terminated string.

  • @fish1r1
    @fish1r1 Год назад +12

    tsar + coding = tsoding lol

  • @slendi9623
    @slendi9623 6 месяцев назад

    I am so sad i missed the stream i wouldve flexed holyc's switches and running holyc in the preprocessor being able to streamprint into the compiler input

  • @systemsbyvedant
    @systemsbyvedant Год назад +1

    Hey is there a place where I can see all these submissions? I think they would be a really great source for referring any new language

  • @johnsmith1953x
    @johnsmith1953x 5 месяцев назад

    *FACT: The Pope is also known as the "Holy See"*

  • @NikolaNevenov86
    @NikolaNevenov86 Год назад +7

    wtf....first time I saw `malloc` I was..."Oh it's - memory allocate". Still malloc sounds better than M-Alloc. Like some people will pronounce char as "car" or "khar"... it's char, short from "character".

    • @illyias
      @illyias Год назад

      Let's be real, the entirety of C's naming convention is a disaster from start to finish. There's nothing redeemable here either way.

  • @deusexmaximum8930
    @deusexmaximum8930 Год назад +1

    Bro looks like Sirius Black

  • @edgardoarriagada9467
    @edgardoarriagada9467 Год назад +1

    There is calloc and realloc as well

  • @lowlevelcodingch
    @lowlevelcodingch 8 месяцев назад

    did he say Tsoding?

  • @meowrbius
    @meowrbius Год назад +5

    Legend ‎Terry and his legendary language

  • @mattiapalmese2971
    @mattiapalmese2971 Год назад +3

    3:45 it's called "malloc" in real C (or holy) and not "mfree" because "mfree" would be calloc.

  • @gnuemacs1166
    @gnuemacs1166 8 месяцев назад

    What Git did u pull from ?

  • @jamespong6588
    @jamespong6588 Месяц назад

    Compiling directly to binary, realtime compiling, it's GOOD

  • @Valerius123
    @Valerius123 2 месяца назад

    goto is only problematic if you write your whole application within a single function. you can't goto across functions as far as i know. that's setjmp/longjmp. if you follow good programming practices goto is a great statement for simplifying messy control flows.

  • @etzerdlasgaudistuben5300
    @etzerdlasgaudistuben5300 11 месяцев назад +2

    you are normies that didnt understand the holy c

  • @plato4ek
    @plato4ek Год назад

    Can anyone explain me the joke about nUmeric vs numEric? Is there a different meaning for the former? (Not a native speaker.)

    • @justinwinch6275
      @justinwinch6275 Год назад +4

      They don't mean different things, it's just that the typical pronunciation is the latter (emphasis on the "er" syllable, not "num") so it sounds weird saying the former. Since he'd only seen "numeric" written in code and not said out loud, he never learned the correct pronunciation for several years until he finally said it out loud and someone corrected him.

    • @illyias
      @illyias Год назад

      ​@@justinwinch6275 The joke is more than that. He'd only ever seen it spelled out, so he thought it was some special programmer lingo - a "numeric". Only afterwards, he realized it's a totally normal word.

  • @albuquerquehotspot7835
    @albuquerquehotspot7835 Год назад +2

    Terry had the … spreading operator decades before ES6 JS 😯

  • @deejaykabwoy44
    @deejaykabwoy44 Год назад +1

    Classes are from the lord😂😂

  • @aasquared8191
    @aasquared8191 Год назад +11

    BASIC when's't

  • @tru2thastyle
    @tru2thastyle 7 месяцев назад

    Terry was a genius.

  • @mik5686
    @mik5686 5 месяцев назад

    straight from god himself, isnt it weird how no one uses holyc in prod?

  • @uindiendanslaville2
    @uindiendanslaville2 Месяц назад

    Blaise Pascal mentioned 👀

  • @ultraderek
    @ultraderek 9 месяцев назад

    Holy Malloc Vim-man.

  • @adityathapa2187
    @adityathapa2187 11 месяцев назад

    How to learn holy c

  • @sameash3153
    @sameash3153 Месяц назад

    I knew terry before he was a meme

  • @whoopsimsorry2546
    @whoopsimsorry2546 Год назад

    U8 * has 8 bytes size

  •  Год назад

    ALL HAIL THE GREAT M'ALLOC

  • @Werfiy
    @Werfiy Час назад

    Terry Legend🙏

  • @rnrbishop
    @rnrbishop 2 месяца назад

    I mean terry was right, linux types are confused by anything not pretending to be a 70s mainframe.

  • @LukeNewcomb
    @LukeNewcomb Год назад

    malloc is a word.

  • @szymoniak75
    @szymoniak75 Год назад

    what did i just watch?

  • @HalCogan
    @HalCogan 6 месяцев назад

    I bet you can't even see them glow in the dark smh tbh

  • @mosomiliardaru
    @mosomiliardaru Год назад

    tom is a genius, his language is better than this

  • @julianranieri6014
    @julianranieri6014 Год назад

    It's absolutely malloc idgaf

  • @marcusmeaney
    @marcusmeaney Год назад +1

    Ameno/10

  • @rust5427
    @rust5427 8 месяцев назад

    these guys are so hot

  • @gregoryshields4258
    @gregoryshields4258 5 месяцев назад

    If you are this dumb about Terry Davis, then you should not be covering his language.

  • @bullpup1337
    @bullpup1337 Год назад

    why does he think holyc is from the 80s? and why does he say “they” pretty sure terrys preferred pronouns was he him lol

  • @fahadali1372
    @fahadali1372 7 месяцев назад

    read about islam

    • @ahhfdhxhdj5312
      @ahhfdhxhdj5312 7 месяцев назад +1

      why would he want to read about a demon possesed pedophile

  • @Marshblocker
    @Marshblocker Год назад +1

    Holy C has no class inheritance.

  • @ІлляМіхневич
    @ІлляМіхневич 6 месяцев назад

    @tsoding mentioned

  • @julienc.8562
    @julienc.8562 Год назад +2

    ThePrimeagen referencing @ts0ding ❤