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 😊
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 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.
@@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.
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"
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
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.
@@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
@@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.
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
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.
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.
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”?😂
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.
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.
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.
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?
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".
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?
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
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.
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."
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
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!
Every US developer I know would pronounce every acronym as if it was a legit word. Be it "malloc" or "URB" and "IRP" (which sound exactly the same). And people made fun of me, when I pronounced "GUID" as "Gee-U-I-D", and since I'm German my manager couldn't resist making bad jokes about "Jew-ID". Especially when jewsh devs were present. Man, that were the good ol' times 😅 Good thing I'm retired though.
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.
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.
@@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.
"I'm a white man, I write my own compiler"
he actually said this, didn't he
@@beamshooter Yeah, look for "Terry Davis gets a phonecall".
chad
Neither of the statements aren't wrong tho.
Use an ISO like a white man
RIP Terry A Davis 🙏
Such a tragic story, the guy was truly amazing
@@DarkerCry he was genius but he wasn't that amazing as a person, he said lots of racist stuff in his times
@@shojauddin2509 lol
@@shojauddin2509 still a genius
@@shojauddin2509 You do know that the nigga had schizophrenia right...
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 😊
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.
@@orbital1337 it is on the type though; but I think I get what you mean. You want *u8 instead of u8*.
@@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.
@@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.
not the only mistake they made
In unholy c, you have to tip your fedora to get any memory... m'alloc
#define NULL ((void *)0x666)
That is the most un-temple os thing I've ever heard.
shut up
You been comprised by the glow in the darks
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"
Wow, Terry Davis. I did just go down that rabbit hole.
I'm going to name my next videogame character Malloc Numerick.
Me seeing this some time in the future and just laughing my ass off because I know where it's from 😆
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
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.
@@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
@@yjlom sizeof(void) is nonstandard, not imp defined. It's ill formed, don't use it :P
@@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.
@@yjlom sizeof(U0) and sizeof(I0) are both 0, sizeof(U64) is 8.
That case range in the switch statement is one of the MANY things that make it truly "holy" ❤
rust
@@anon-fz2boywnbaw
Holy Nim, then.
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.
Or uint64_t right?
people like to over-complicate things. modern software is a god damn clusterfuck
@@YourMom-rg5jkSounds like something Terry Davis would say
Rest in Peace Terry! I've been working on a tutorial series. Hopefully more apps in HolyC soon :)
I see you followed through. Good job.
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
Reminds me of "clang" being pronounced "C-lang". It's called "clang" (like the sound) by the project deveopers.
dude, it's not a holeyck. its definitely holy c.
@@aasquared8191 i think they're talking about the "MAlloc" situation, but okay
We also have flang.
its holy c like holy see, the jurisdiciton of the pope
It should be pronounced as Holy Shee or Holy Chez💩
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.
Pseudo intellectuals mocking holy c vibe. i cant keep watching
i think calling me a pseudo intellectual is an insult to pseudo intellectuals
wasn't ready for that 😂@@TheVimeagen
I remember making Quake maps and not knowing what "nonsolid" meant
actually you can use the "..." range when using clang, many compiler implement it but it isn't part of the standard !
It's from gcc, the flag for it in clang is even gnu-case-range
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.
he loved God and was mentally ill, i have no doubt God had mercy on him 🥳
HolyC also have other trickeries that are handy actually...
Case range in the switch statement? Holy C... Why the F C didn't have that
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.
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.
I think these guys glow in the dark
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”?😂
the only god programmer is terry imo
"It looks like Go"... err... it looks like C?
Chat blew up about U0 being used in place of void and they didn’t even notice
5:50 In fact gnu extension added support for that.
terry himself referred to it as "malloc" og terminology
Let’s just pray that MAlloc never fails.
so don't lean over on a motorcycle
get the word rust off my holy c
R.I.P. Terry A Davis
I can imagine Lex Fridman writing his own compiler, like a machine.
Is that TPope in the background 😂💀
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.
are you there yet
@@leehaswell4206 bruh i commented 3 days ago and you responded yesterday :skull: no way im that quick
It's been a long goal of mine to write an interrupt routine in Haskell. Wish me luck guys !!!!!!!!!!!!!!!!!!
are you there yet
@@LanceWillMakeIt not yet. :>
honestly impressive how little you know for what and how youre doing
exactly
@@szymoniak75 peak dunning-kruger codefluencers
theyre probably not too dumb but the confidence is repulsive
what do you mean
Yeah this is what stood out for me as well
I've always pronounced it "MAL-loc." That just seems the right pronunciation. Knowing, of course, it is a memory allocation.
hands down correct
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.
lmao I dont know why they are doing it but the codes are written by viewers
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.
ua-cam.com/video/gsrNrlA-dog/v-deo.html
@@joraquest2306 I highly doubt Terry A Davis came back from the grave to send his code to these literally whos.
I have no idea what any of this means but my faith in God has only grown watching it
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?
maya hee, maya hoo, maya ho, maya haha! numa numa eric
Legend Terry and his legendary language
3:33 always make sure malloc returns a valid pointer before proceeding to use it.
Actually, in Holy C we use a faith-based system. If you're not a sinner you always get a valid pointer back!
@@TonKcedua my bad. Guess I need to work on my faith 🛐
templeos is so lightweight, malloc never fails, also throws 'OutMem' if fails
When are you going to review the Jai code?
I might try to quickly get it done before you review it.
have to come clean. I also didn't realise malloc was MAlloc
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
tsar + coding = tsoding lol
TempleOS supports images inside text files. Like, you can have an animated gif in your source code file.
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".
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.
*FACT: The Pope is also known as the "Holy See"*
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?
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
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.
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."
Terry had a way with his words 😂
wheres go 🧐
Bro looks like Sirius Black
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
you are normies that didnt understand the holy c
Then why is not MemAlloc, to align with MemCpy?
To make it easier for C programmers to know which functions to use and such I guess
So malloc = MAlloc and MemCpy = memcpy
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!
because god said "no!"
Holy Malloc Vim-man.
Every US developer I know would pronounce every acronym as if it was a legit word. Be it "malloc" or "URB" and "IRP" (which sound exactly the same). And people made fun of me, when I pronounced "GUID" as "Gee-U-I-D", and since I'm German my manager couldn't resist making bad jokes about "Jew-ID". Especially when jewsh devs were present. Man, that were the good ol' times 😅 Good thing I'm retired though.
What do you think the King would say while watching these two monkeying around while reading his code hmmmm
only God can criticise Terry's code
BASIC when's't
HOW DARE YOU?!
05:39 it's c gnu extension
Classes are from the lord😂😂
everyone knows malloc is short for mallocate
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.
ALL HAIL THE GREAT M'ALLOC
Terry was a genius.
Terry had the … spreading operator decades before ES6 JS 😯
There is calloc and realloc as well
What Git did u pull from ?
3:45 it's called "malloc" in real C (or holy) and not "mfree" because "mfree" would be calloc.
straight from god himself, isnt it weird how no one uses holyc in prod?
I mean terry was right, linux types are confused by anything not pretending to be a 70s mainframe.
malloc is a word.
did he say Tsoding?
Can anyone explain me the joke about nUmeric vs numEric? Is there a different meaning for the former? (Not a native speaker.)
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.
@@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.
what did i just watch?
How to learn holy c
I bet you can't even see them glow in the dark smh tbh
U8 * has 8 bytes size
tom is a genius, his language is better than this
Ameno/10
It's absolutely malloc idgaf
these guys are so hot
If you are this dumb about Terry Davis, then you should not be covering his language.
why does he think holyc is from the 80s? and why does he say “they” pretty sure terrys preferred pronouns was he him lol
read about islam
why would he want to read about a demon possesed pedophile
Holy C has no class inheritance.
it does
@tsoding mentioned
ThePrimeagen referencing @ts0ding ❤