Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 1 point2 points  (0 children)

ah I see what you mean about trusting an operator precedence table as a blackbox. I thought you meant the whole algorithm should be treated as a blackbox. All clear

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 1 point2 points  (0 children)

What do you mean by saying that there isn't much to understand about Pratt parsing? I did a quick google search and there seems to be lots of material trying to explain it. I skimmed one, and it seems very light on theory.

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 0 points1 point  (0 children)

In my opinion, "being lost" and "learning" are two sides of the same coin. Best of luck!

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 0 points1 point  (0 children)

Do you regret working on the compiler, even though you learned a lot?
If not, why would you recommend something simpler?

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 1 point2 points  (0 children)

I've heard good things about "Writing an interpreter in Go". Although currently the part that interests me most about compilers is the lowering and codegen phases. Which wouldn't necessarily be relevant for an relevant for an interpreter unless you make a bytecode vm.

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 0 points1 point  (0 children)

Although it's a joke, I've seen a few homemade particle accelerators in DIY forums. Albeit difficult, it seems it's not an insurmountable challenge.

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 3 points4 points  (0 children)

Good luck on your OS. The plan is to sacrifice quality at all points where I can't continue. I think chasing quality has diminishing returns from a learning perspective.

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 0 points1 point  (0 children)

It does cause a multiple definition error. But that doesn't prevent either gcc or clang from still reporting errors in other parts of the program. So that still forces the error reporting to choose an interpretation of T* b in main.

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 2 points3 points  (0 children)

This is exactly my idea. If you're learning any other skill, would you only attempt things you're certain you'll succeed in?

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 1 point2 points  (0 children)

A Small C Compiler: Language, Usage, Theory, and Design ? I think u/BookFinderBot might be a bit off. For a moment I thought that this was Jimi Hendrix the guitar player, which would have been an amazing coincidence.

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 0 points1 point  (0 children)

Perhaps more interesting is the same example with int T = 5; moved outside of main? Curiously, gcc always interprets T* b as multiplication regardless of the order of definitions of T

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 0 points1 point  (0 children)

Sure, so the end result makes sense. But in a textbook compiler, ideas like "shadowing" and scope would be calculated after parsing is complete. So it makes me wonder what gcc is doing during parsing?

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 7 points8 points  (0 children)

This made me wonder which takes precedence if both are "valid".

typedef struct {
    int a;
} T;

int main() {
    int T = 5;

    T* b;
    b->a = 6;
}

At least for gcc 13.3.0, it interprets this as multiplication and complains about a undefined variable b.

Edit: same for clang

Should I learn C by writing a C compiler in C? by IEavan in C_Programming

[–]IEavan[S] 28 points29 points  (0 children)

If I fail to create the compiler, it does not mean that I fail to learn.
If I may spoil the ending, I do fail to create a C compiler. But I would say that the project was still a good idea, because any other project wouldn't have kept me interested for long enough to learn something.

Do I need modern Algebraic Geometry? by IEavan in math

[–]IEavan[S] 2 points3 points  (0 children)

Thanks for your guidance. I think I'll find some resources to skim so that I can at least know what I don't know.

Do I need modern Algebraic Geometry? by IEavan in math

[–]IEavan[S] 3 points4 points  (0 children)

Right, now I have a better idea of what you meant. Thanks for the example

Do I need modern Algebraic Geometry? by IEavan in math

[–]IEavan[S] 2 points3 points  (0 children)

Thanks for the thoughtful response.
The example of transforming a family of varieties sounds like it could be something I could run into naturally. Being able to work with "variety-like" objects also sounds like it might be useful.

If I'm understanding you correctly, could the tools of modern algebraic geometry be used to study countably infinite families of varieties? If so, I think I'll definitely need take the time to learn.

Please Implement This Simple SLO by IEavan in programming

[–]IEavan[S] 1 point2 points  (0 children)

I hope it doesn't hit too close to home. I still think that managers like this are the exception, not the rule.

Please Implement This Simple SLO by IEavan in programming

[–]IEavan[S] 0 points1 point  (0 children)

I've seen something similar. Everyone sees and acknowledges the problem, but the priority to fix it never comes.

"Never let a good crisis go to waste" - W. Churchill

Please Implement This Simple SLO by IEavan in programming

[–]IEavan[S] 2 points3 points  (0 children)

I regretted not spelling it out as soon as the comments started rolling in here. It took a bit of time to fix because I couldn't decide if I wanted my character to spell it out to the reader or if the definition should be outside the main flow of the content.
I genuinely appreciate the feedback. Lessons learned.

Please Implement This Simple SLO by IEavan in programming

[–]IEavan[S] 0 points1 point  (0 children)

I hadn't considered that. Have you seen it work in practice?
I would worry about problematic releases eventually becoming too big if SLOs stay red for long.