<moon-child>
and less 'todo err' I just didn't get around to writing proper error messages for those bits yet
<zid>
have you encoded all the rules in the code there?
<moon-child>
yeah, that's all the parse rules for a reasonably complete subset of c, albeit without function pointers, and without certain combinations of arrays and pointers, I think
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<moon-child>
tokenizer is separate
<zid>
"huge chain of ifs and some recursion" I was sadly sort of hoping to avoid :p
<moon-child>
there's 'parser combinators' you may want to look into
<zid>
I guess if you want decent error messages and stuff it's sort of mandatory though
<moon-child>
yeah
<zid>
I guess I just don't want to start when I don't ultimately know what it'll end up looking like
flx has joined #osdev
<zid>
like if I forget about function pointer declarations and then have to rewrite a big chunk
<zid>
because I structured something badly
<moon-child>
you don't really have to rewrite to add new parse rules, assuming your overall parse structure is right
<moon-child>
zid: btw did you see my error messages for declarations
<moon-child>
grep for 'done:'
<zid>
that's the thing though :P
<zid>
I'm not sure my parse structure will be right
<zid>
I'm just too lazy to prototype it get it wrong, then write it correctly I guess
<zid>
Being able to browse an example AST for a decently complicated short C file would probably be fairly useful
<zid>
so that I don't forget to think about anything
<moon-child>
honestly I don't think parsing is that easy to fuck up. It's just boring
<moon-child>
then again, maybe I just got lucky and stumbled across a good design :P
<moon-child>
but I'm doing an ipc design now and _that_ is hard. I'm not sure whether it makes sense to burn an initial message and response into the protocol. On the one hand, I think not wanting to handshake is pretty rare. On the other hand, maybe you wanna do a multi-step handshake
<moon-child>
dumping _all_ the work of handshaking onto the application seems like unreasonably cruel. But if an app needs multistep handshake, then it has to treat the first message of the handshake separately, or else ignore the protocol's 'initial handshake', both of which are ugly
<zid>
am I allowed to go from the middle
<zid>
and do expressions first
<zid>
`bc` then outwards into types and then containing functions and then a containing TU
<zid>
expressions > blocks > functions > TUs
<zid>
I can make a mess of doing expressions in a freeform scenario then just add nice wrappers
flx- has joined #osdev
flx has quit [Ping timeout: 258 seconds]
mahmutov has quit [Ping timeout: 258 seconds]
<moon-child>
depends on exactly what an 'expression' is
<moon-child>
something like 'x + 3*2' at that level you wanna express as two assignments, not a single expression
<moon-child>
2+3*x. no constant folding
sts-q has quit [Ping timeout: 268 seconds]
<zid>
expression as in language level
<moon-child>
try to jettison those asap
<moon-child>
imo
<zid>
(((a)+b)) is what I am trying to make a tracelog of in my head
<zid>
outright ignoring them always gives you one or the other
<moon-child>
but you don't have to represent the parens explicitly in your parse tree, so you don't ahve to get rid of them later
<moon-child>
the parens are implicit in your callstack
<zid>
I don't intend to represent them, like I said
<zid>
I'm recursing on them to try ignore them
flx- has quit [Ping timeout: 258 seconds]
<zid>
but there's the awkward (a)+b case
<zid>
where I have a left and that's as far as I can go so I have to return with just a left and no op or right
<moon-child>
so, what's the problem?
<zid>
trying to figure out if I wanna pass a pointer forward or return an incompletely filled out struct and check if(node->left) constantly and stuff
<zid>
or maybe I can make it 10x simpler by peeking to see if the entire expression is ( tok )
<zid>
no idea because I've not written it either way yet
<moon-child>
zid: I think your conception of the parse tree is wrong
<moon-child>
do you handle 'a;' ?
<moon-child>
f(1, 2, 3)?
<zid>
I don't handle anything yet :P
<zid>
yea how *do* grammars treat function calls, that's a good point
<zid>
left = f, op = function_call, right = more nodes?
<moon-child>
'node' is a sum type. It may be a primary expression (identifier | literal), binary expression (operator * expression), unary expression (operator * expression * expression), ternary expression (you get the point), cast expression (type * expression), function call (expression * array of expressions), etc.
<moon-child>
'left', 'op', and 'right' are not essential components of the node. They _happen_ to be part of the 'binary' variant of the node
<zid>
It just felt like the simplest way to describe it
<moon-child>
it's not
<zid>
how can you disagree with what I feel, wat
sts-q has joined #osdev
<zid>
I've never read the dragon book, obviously
<moon-child>
i didn't mean you don't feel that, I meant it's not the case that that's the simplest way
<moon-child>
i've never read the dragon book either
<zid>
function calls always know one side is the function name, and the other is the arg list
<zid>
so it still works in a binary context in my mind shrug
<zid>
and it's directional so it's just 'right' being unioned with an arglist * instead of a node * or whatever, and an arglist is just an array of further expressions
<zid>
like 1, or g(x) or NULL or whatever
<zid>
what's the encoding for this
<moon-child>
I think it's relatively normal as far as ast structures go
<moon-child>
zid: what do you mean by encoding?
<zid>
ah utf-8
<zid>
your server doesn't give a correct mime
<zid>
my browser tried latin-1
<moon-child>
it's just ascii
<zid>
no, it's utf
<zid>
«»
<moon-child>
oh no there is some unicode. yea utf
<zid>
I assume those are double angle brackets and not masses of A with umlauts and stuff :D
<moon-child>
yea
<moon-child>
i used « for << for...no very good reason
<zid>
yea this is pretty much what I said
<zid>
your } call; struct/union is two pointers
<zid>
one for function identifier, one for args
<moon-child>
abuse of notation
<moon-child>
first one is a pointer, so the size isn't infinity. The second one is an array
<zid>
I don't know any notation, so you're going to have to humor me
<moon-child>
but the point is _conceptionally_ there's not universal left/right, there's a bunch of different variants of a sum type
<zid>
I was thinking of it more of a typed union of things
<moon-child>
sum type and tagged union mean the same thing
<zid>
and function calls aren't commutative so left and right still make sense
<zid>
so I'm surprised you cared so much
<zid>
(1,2,3)f; is not the same expr
<zid>
again, I've not read the dragon boo
<moon-child>
again, I've not either
<zid>
so I think in 'typed unions', not 'sum types'
<zid>
I've literally seen sum type for the first time 35 seconds ago
<zid>
when you said it
<moon-child>
ok, let's go back. Main thing is you said 'trying to figure out if I wanna pass a pointer forward or return an incompletely filled out struct and check if(node->left) constantly and stuff' and I'm not entirely sure why this is an issue in the first place
<moon-child>
everything since then is superfluous
<zid>
So anyway, to get back on track, (a) is annoying.
<moon-child>
why is (a) more annoying than a?
<zid>
because a is a complete expression
<moon-child>
what is 'complete'?
<moon-child>
compare (a)+2 to a*5+2. is a*5 less annoying than (a)?
<zid>
and my (a) is waiting for a + so I know I'll want {'+', a, b} as my final node, at least in my head
<zid>
but if I recurse on ( then +b is out of scope
<zid>
oh right my intermediate form just needs to actually.. exist
<zid>
a is an expression in its own right, being added to the expression b in its own right
<moon-child>
note that 'a' by itself is an additive expression
<zid>
yea, just figured it
<zid>
a is an entire expression, now I don't have to care
<zid>
if my example were (a+b)+(c+d) to begin with I'd have had less trouble thinking about this :D
<moon-child>
well either way you figured it out now so, no harm done :)
iorem has joined #osdev
YuutaW has quit [Ping timeout: 258 seconds]
YuutaW has joined #osdev
nyah has quit [Ping timeout: 258 seconds]
<zid>
This is incredibly unrelated: Anyone know why mobos basically refuse to deal with CPUs they don't have microcode updates for? afaik the chips aren't bricks without you updating it at boot
<zid>
they can at least run enough code to update the microcode afterall :
<kingoffrance>
does cpu not ship with microcode? sounds like its just a support thing, ensure people are using "support versions"
<kingoffrance>
*supported
<kingoffrance>
not saying i agree, just i bet that is how it will be justified
regreg has joined #osdev
<kingoffrance>
supported combinations i should say
<moon-child>
zid: I think it's that the motherboard expands to add some new feature that the old ucode doesn't know about, and the mobo doesn't want to be backwards-compatible for some reason?
<moon-child>
at least that was my impression
dude12312414 has joined #osdev
<zid>
I doubt the bios is using avx or anything though, I think they just don't want to risk crashes
<zid>
using broken-from-factory ops
GeDaMo has joined #osdev
mahmutov has joined #osdev
<clever>
zid: from what ive heard, windows relies entirely on the bios to handle microcode updates, while linux allows prepending the microcode file to the initrd
<clever>
so windows requires a bios update to fix the microcode bugs
flx has quit [Remote host closed the connection]
flx has joined #osdev
ElectronApps has joined #osdev
iorem has quit [Quit: Connection closed]
<moon-child>
somebody here said memory is interleaved between banks automatically by the memory controller. That changes in numa, right?
regreg has quit [Ping timeout: 256 seconds]
<kc8apf>
moon-child: kinda
<kc8apf>
With NUMA, each node generally has a chunk of the address space. Within a node, addresses are likely interleaved across memory controllers and DIMMs.
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<moon-child>
a node is different from a socket?
Brnocrist has quit [Ping timeout: 268 seconds]
anon16_ has joined #osdev
anon16 has quit [Ping timeout: 250 seconds]
flx- has joined #osdev
rsonx has joined #osdev
flx has quit [Ping timeout: 258 seconds]
rsonx has left #osdev [part]
mhi has joined #osdev
<Affliction>
On modern intel, they're 1:1
<Affliction>
On old threadripper/epyc, each die has its own mem controller, which has its own node
<Affliction>
on modern threadripper/epyc, I think they're 1:1 again.
<Affliction>
Though TR/EPYC can be configured to not use numa, I believe by giving each controller a different 'offset' in the interleave
<Affliction>
On older platforms where the mem controller is in the northbridge, I guess you can have multiple sockets in a numa zone
sm2n_ has joined #osdev
gorgonical has joined #osdev
pieguy128 has joined #osdev
freakazoid343 has quit [Ping timeout: 256 seconds]
nanovad has joined #osdev
bleb has joined #osdev
Bitweasil has joined #osdev
transistor has quit [Ping timeout: 250 seconds]
Mutabah has joined #osdev
transistor has joined #osdev
Burgundy has joined #osdev
sortie has joined #osdev
Arthuria has joined #osdev
nyah has joined #osdev
mahmutov has quit [Quit: WeeChat 3.1]
iorem has joined #osdev
mahmutov has joined #osdev
mctpyt has quit [Ping timeout: 258 seconds]
ElectronApps has quit [Remote host closed the connection]
ElectronApps has joined #osdev
anon16_ has quit [Ping timeout: 276 seconds]
anon16_ has joined #osdev
regreg has joined #osdev
Arthuria has quit [Ping timeout: 256 seconds]
Burgundy has quit [Ping timeout: 268 seconds]
mhall has quit [Quit: Connection closed for inactivity]
Burgundy has joined #osdev
regreg has quit [Remote host closed the connection]
regreg has joined #osdev
mctpyt has joined #osdev
isaacwoods has joined #osdev
regreg has quit [Remote host closed the connection]
regreg has joined #osdev
sortie has quit [Remote host closed the connection]
sortie has joined #osdev
ElectronApps has quit [Read error: Connection reset by peer]
<kc8apf>
On my AMD reference platform with Milan CPUs, I can choose the number of NUMA nodes per socket in EFI.
cultpony has joined #osdev
devcpu has joined #osdev
<zid>
I have numa on a single socket intel, fear me
mcfrdy has quit [Quit: quit]
mcfrdy has joined #osdev
froggey has quit [Ping timeout: 276 seconds]
froggey has joined #osdev
mctpyt has quit [Ping timeout: 250 seconds]
mctpyt has joined #osdev
dormito has joined #osdev
mahmutov has quit [Ping timeout: 250 seconds]
fly_ has joined #osdev
mahmutov has joined #osdev
<fly_>
how much knowledge on the assembly language do i need to get started on os dev ?
<sham1>
You can learn as you go, although the more the better ofc
<GeDaMo>
Most OSs are developed in higher level languages, only need small amounts of asm
<GeDaMo>
Knowledge of things like page tables is probably more important
froggey has quit [Ping timeout: 272 seconds]
froggey has joined #osdev
mctpyt has quit [Ping timeout: 258 seconds]
<fly_>
got too into this python code that i forgot to check, haha sorry guys
<fly_>
page tables, noted GeDaMo, will research that asap
dude12312414 has joined #osdev
<fly_>
i have only experimented with asm using the PIC microcontrollers so i dont know yet how much time to invest when learning it for os dev
<j`ey>
like sham1 said you can learn as you go, mostly you need asm for instructions that arent representable by whatever programming language
<fly_>
got it! Thank you j`ey!
regreg has quit [Ping timeout: 252 seconds]
pretty_dumm_guy has joined #osdev
heat has joined #osdev
gorgonical has quit [Ping timeout: 268 seconds]
pretty_dumm_guy has quit [Quit: WeeChat 3.2]
gorgonical has joined #osdev
GeDaMo has quit [Quit: Leaving.]
mctpyt has joined #osdev
Arthuria has joined #osdev
Arthuria has quit [Remote host closed the connection]
<sortie>
Tonight in osdev: I hosted a video meeting with a buncha people and ended up porting lynx
Arthuria has joined #osdev
devcpu has quit [Quit: leaving]
Arthuria has quit [Remote host closed the connection]
devcpu has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<sham1>
"sortie ports the darndest things while in meetings"
<sortie>
I'm actually, uh, quite seriously, pondering releasing my OS on vinyl
<sortie>
Booting that on real hardware is gonna require some hardware that probably doesn't quite exist but I can definitely do stuff with a virtual machine
<sham1>
If you can load software from compact cassettes, you can load it from an LP
<sham1>
Heck, probably the same interface
<j`ey>
record a vinyl that is spoke word of all the source code
<sortie>
I absolutely want to make a signed vinyl release of my OS and mail it to music artists
<sortie>
“Thanks for signing your album, let me return the favor”
<fly_>
j`ey, the first audiobook version of an OS to ever exist
<j`ey>
fly_: :)
<j`ey>
Today in osdev for me was: booting Linux on the m1
<j`ey>
more like compiling-other-peoples-code, but still
<sortie>
j`ey, that's like half of osdev :)
<heat>
i would never use other people's code
* heat
hides musl and acpica
<kingoffrance>
nah, you just need sound card and input :) no special hardware, just a sound card driver :)
seds has joined #osdev
dude12312414 has joined #osdev
dude12312414 has quit [Remote host closed the connection]
srjek has joined #osdev
heat has quit [Remote host closed the connection]
isaacwoods has quit [Quit: WeeChat 3.2]
nyah_ has joined #osdev
nyah has quit [Killed (calcium.libera.chat (Nickname regained by services))]
<bslsk05>
twitter: <__phantomderp> .. Wait. Wait wait wait wait.   If I'm using an assert macro and someone puts a condition like ASSERT(n%s) and I serialize that and put it in fprintf.... oh my god. Oh my _god_.
<moon-child>
T_T
mahmutov has quit [Ping timeout: 250 seconds]
<klange>
This sounds like a strawman. C doesn't have "ASSERT", and any sane implementation of assert() that includes the original statement passes it as a separate %s-formatted argument, not the format string.
<zid>
I don't even get what he's talking about
<zid>
oh oh, he's using fprintf wrong, I get it
<klange>
If you do something immensely stupid like make your assert macro ram together the stringified statement as the format string, you will be punished for it
<zid>
passing the input as the format
<zid>
instead of the input
<zid>
like.. every single beginner crackme is printf(argv[1]); and you have to smash it with 5n
<zid>
%n
<zid>
use %p to dump all the stack contents, then %n to change them
<geist>
Hmm i think i may do something stupid like that…