The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
Yes, error checking isn't usually added until it starts to "work", so it can cause upheaval. But it's so much easier to debug if the parser--and also what is basically an interpreter, for me--can pinpoint where they failed, with a message that makes sense. And keep going, so that you don't have to uncover one problem at a time.
end is the position of the delimiter where the expression ends. It's found by doing a lookahead for the closing punctuation, which is one of ;},)]:= depending on the context. If something goes wrong while parsing the expression, a log containing the expression is generated and the parse resumes after end. I guess that makes it LL(*) if I remember correctly.
Man are you optimist... I would have said 95-5 or even 98-2
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
Recursive descent parsers are the cat's ass! Others are inscrutable by comparison. In our compiler course, we had a choice of what kind of parser to implement. I was the only one who chose recursive descent. It was easy to enhance, so it ended up handling a larger subset of Algol than the others. But boy, was it slow! It was written in Simula-67, running on a PDP-10, and probably backtracked too much. Adding backtracking statistics would have revealed if it was doing something silly.
As reported in Paging-Mr-Cthulhu[^] I'm dealing with "bad" HTML (not that any HTML is truly good).
The first attempt used a Regular Expression to grab the TH and TD elements (within TR elements of course). Hence the above reference. It works.
The second attempt used HtmlAgilityPack with good results, but I doubt I can get it installed on the server, and it didn't provide as much feedback as I'd like. It works.
Sooo... yesterday and today were spent implementing an HTML-to-XML process. Using a Regular Expression to grab anything which looks roughly like a tag.
Then the process iterates the tags, matching end tags with start tags, and figuring out how to deal with unmatched start and end tags (and firing events for such aberrations).
The result is an XmlDocument, which enforces well-formed XML (but not necessarily valid XHTML).
Programming languages are for nerds like us; HTML makes room for everyone else.
Besides, it's HTML that made the Internet; without HTML there would be no Internet, so it's one of the most important inventions in the entire history of the world.
I just envisioned a dev-only Internet -- CP, SO, 10,000,000 blogs bitching about the latest Star Wars movie, endless rants about preferred coding standards, and everything else about why one programming language is supreme, and the rest are all garbage.
Not a pretty sight...
I wanna be a eunuchs developer! Pass me a bread knife!
I've spent several days adding a bunch of foundational features to Parsley like composition parsing, lex priorities, additional firsts and follows hints and bugfixing.
The upshot, is it now parses Slang except for directives and comments both of which it currently discards, but i'll fix it shortly. It's not critical. I'm taking a novel approach with comment preservation - or at least I haven't seen it using other parsers and lexers. I have three major states for a terminal - normal, hidden, or skipped. If it's skipped, it still picks it up in the lexer and gives you the skipped tokens in each advance in the parser, as a separate list, so you can get them "out of band" and not interfere with the regular parse. In my hand-rolled slang parser i just checked for comments everywhere, which is buggy and stupid, but sometimes stupid works.
I still have quite a bit to do before it can do all the things the hand rolled parser can do, but at this point it's 80% my grammar that needs to be coded.
The grammar parses, but i'll be putting in => actions to build the codedom tree from the parse tree. That way if i call EvaluateXXXX() on the parser i get a codedom tree back.
At that point it will do what the hand rolled parser does and i can swap it out and pray i got it right
But for now, an article will have to suffice.
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.
Last Visit: 23-Feb-20 20:09 Last Update: 23-Feb-20 20:09