|
going back through some code for LALR(1) table generation. The math is stupid. Like, ridiculous. If you say you understand it, you don't understand it.
Comments? They don't help here. Comments don't cover this math.
LALR(1) Parsing[^]
barely covers it (not touching the math at all, but the concepts)
and going back through this code to retool it (code rusts) is a nightmare on wheels.
i'm trying to figure out how to document it better, and honestly, I got nothing. it needs a book
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I may be in the minority here, but I must admit I loved the Dragon book when I used it in Compiler Theory I (I didn't take the optional Compiler Theory II course) at university. For those who're keeping track, the year was 1984. Those were good times. When we watched our RAM usage and clutched reams of 14" fan-fold hard copy close to our heart lest the Bernoullis suffered a head crash. When we smoked cigarettes and drank endless pots of coffee into the night, warmed by the soft glow of the CRTs at the otherwise dark computer center.
God, it felt good to be invincible...
/ravi
|
|
|
|
|
Those were the days...
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
heady days!
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
What you need is A Tutorial Explaining The Tutorial Explaining LALR(1) Parsing
To understand the tutorial you must first understand the tutorial... Or was that the tutorial on another topic?
|
|
|
|
|
I got it running. A few minutes ago actually, all ported into my newer parser generator codebase.
woot.
what a monster that algorithm is. Utter gibberish.
"Here, take this and build a state machine with it"
"Use the state machine to construct this temporary grammar, which we will throw away"
"Now take the state machine, run it a few times, then throw it away too"
"Now take this dead chicken and wave it over the result"
Seriously, that's LALR(1) computation.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I've never even heard of LALR and I suck at math
Everything you're doing is literally witchcraft to me!
Now where did I leave my torch and pitchfork...?
|
|
|
|
|
The worst part is I'm horrible at math too.
I mean, I'm good at concepts, but I was a homeless teen which wasn't conducive to a great high school education, and i wound up at microsoft at 18 instead of going to uni. All of that impacted my math. A lot.
So i am effing winging it on an algebra education and sheer grit.
I haven't blown myself up yet at least.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
codewitch honey crisis wrote: I was a homeless teen which wasn't conducive to a great high school education, and i wound up at microsoft at 18 instead of going to uni Now there's an interesting story
What function did you have at Microsoft? I heard it's pretty hard to get in even for University graduates.
codewitch honey crisis wrote: I haven't blown myself up yet at least. Just watch out when you're going to practice fire spells
In fact, be this kind of witch[^] not this kind of witch[^].
Although it seems you've already lost your soul to the black arts of math and parsers (and not using brackets around single line if-statements and multiple return statements)
|
|
|
|
|
i started in SDET (testing) and while i was there honed my C++ some. It was a contract position.
then i moved on to development with some other companies.
When I went back next time I was doing C++ dev on the visual studio team and wmi team (i was a straddler, they had some of those)
As far as why I was homeless, it was a combination of things that in the end made living with my parents untenable to where couch surfing and even staying on the streets was better than going home. It wasn't all my parents either. I was something else back then. Crazy as they come too. I was ready to be on my own well before i was ready to be on my own.
I started coding when I was 8. I just picked it up, so by the time I was at microsoft I had already been writing little apps for 10 years.
My timing was also good. I got in around the dotcom boom when they were hiring like crazy and I had some friends of a friend that worked there.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
codewitch honey crisis wrote: As far as why I was homeless, it was a combination of things that in the end made living with my parents untenable to where couch surfing and even staying on the streets was better than going home. Ouch, sorry to hear that...
codewitch honey crisis wrote: I started coding when I was 8 I did some VB coding at that age, only to not do it anymore for about 20 years.
I remember creating a small forest in WinForms with some wizard picture that you could "walk" around to the edge of the screen only to reappear on the other side of the screen.
And a little quiz application that had like 10 multiple choice questions and kept track of your score.
Man, my skills sure have deteriorated since then
codewitch honey crisis wrote: I got in around the dotcom boom If I'm not mistaken that was at the end of the 90's (I was still in elementary school), so if you were 18 at the time that would make you... an old code hag?
Just kidding, around 40ish, but you look a lot younger on your profile pic (and I should mention I'm horrible at guessing age)
|
|
|
|
|
yeah, I'm 40 - i was 8 in '86
winforms - I didn't get into that until after the aughts.
i am definitely an old code hag.
and also a witch, as anyone who has seen my multiple returns and lack of brackets can attest
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
codewitch honey crisis wrote: yeah, I'm 40 - i was 8 in '86 I was born a year later
codewitch honey crisis wrote: my multiple returns and lack of brackets Comes with your age
|
|
|
|
|
i'm just too old to care anymore
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
as far as me looking young, i get that a lot.
it's because i bathe in the blood of VB developers. It's wonderful for the skin.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
codewitch honey crisis wrote: it's because i bathe in the blood of VB developers At least they're good for something
I switched to C# since then so don't get any ideas...
|
|
|
|
|
you're still looking kinda supple.
have you used the "unsafe" keyword yet?
if not, you still have your innocence.
the essence of youth.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I don't think so...
Although I've used some DllImports stuff in VB which in basically the same (I did VB for a few years when picking up programming in 2010)
Besides that I've coded in JavaScript, so my essence is rotten to it's very core
|
|
|
|
|
ah yes, javascript.
or as i like to call it, a back door into convincing a browser to run assembly code
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
adding, I love the name of your LINQ->JS javascript file. that's about right.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Sander Rossel wrote: and not using brackets around single line if-statements and multiple return statements
It's a question of economy.
I only have so many brackets to go around, but i have plenty of returns.
in truth, i hate brackets. but i also hate python so i am vexed.
and as far as returns? I prefer them to giant nested if elses, but i'm sure i have haters over that.
i also *gasp* use break and continue as control statements.
in fact, the only reason I don't use goto anymore is i generate most of my non-trivial state machine code and using array based tables runs faster than gotos do in .NET
Of any maintenance issue i have had in my code, it hasn't been because of that.
it's not spaghetti if you make the branches clear, and there's all kinds of ways to do that.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
codewitch honey crisis wrote: Of any maintenance issue i have had in my code, it hasn't been because of that. I've had maintenance issues with both...
Nasty production bugs, because someone had a return statement halfway a function that I didn't see (or expect).
Same with some non-bracketed single line if-statements (paired with really weird indentation).
When using brackets and single return statements you just CAN'T go wrong, never ever, which is why I really prefer it over not having them (even if it's sometimes cleaner to not have them).
Of course I'd expect nothing less of a WITCH!
|
|
|
|
|
in my defense, when I'm with a shop i adopt house standards.
this is just me coding for me, so team issues aren't as big.
and as far as sharing goes, it's free.
because i live in microsoftland when i'm with a team if i gravitate toward lead which i usually do, i tend to impose standards a bit like i was used to when working at MS.
my code looks different depending on who is paying for it.
i write how i like it when i write it for me. =)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
> To understand the tutorial you must first understand the tutorial
That's some straight up Rambam right there.
Takes me right back to The Guide for the Perplexed.
"You can't read this until you're properly initiated"
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
codewitch honey crisis wrote: That's some straight up Rambam right there.
Takes me right back to The Guide for the Perplexed.
"You can't read this until you're properly initiated"
The Rambam's philosophy in Guide to the Perplexed is rooted in Greek philosophy. I would recommend taking a few Classical philosophy classes (if any University still gives them ), and then try re-reading it. It'll make much more sense then.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|