|
lopatir wrote: only if you get a seal of approval for the head of the house.
My wife says I'm the head of the house, but she's the neck and the head goes where the neck points it.
CQ de W5ALT
Walt Fair, Jr.PhD P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Icy what you did there.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
Only if you're not bipolar, otherwise they'll have Nunavut.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
So some of you know I write a lot of parser generator stuff.
You'd think with how much time I spend writing this stuff, I'd use a generator to do most of my parsing.
I do not.
About 80% of my real world parsers are hand rolled, because they're quicker to develop for really simple parses, up to the roughly the complexity of parsing regex
So I write a class called ParseContext which helps with the task IMMENSELY, including error handling, abstraction of TextReader vs String parsing, and common functions like SkipCCommentsAndWhitespace(), and TryParseJsonValue (I use JSON literals all the time)
So I post it here, because it's crazy useful. More useful than my parser generators most of the time.
Easier Hand Rolled Parsers[^]
And what do I get? Not 5 stars like my parser generator articles. No sir. I get not even 4.
people just don't know what's good for them
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: people just don't know what's good for them That's not a surprise... you just have to see the news everyday
On the other hand... there is a lot of people who votes down just because they think "that's bad" when they don't actually have a clue of what it is being said / shown.
M.D.V.
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.
|
|
|
|
|
Nelek wrote: there is a lot of people who votes down just because they think "that's bad" when they don't actually have a clue of what it is being said / shown.
M.D.V.
That would seem to indicate that the article didn't explain thing clearly enough.
CQ de W5ALT
Walt Fair, Jr.PhD P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
There are things where, if you don't have a certain prior knowledge you won't understand it, no matter how good they are explained.
But if you are someone that can understand everything... good for you.
I am honest enough to say that I don't understand what is being said in an article more times than I would like to.
M.D.V.
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.
|
|
|
|
|
Nelek wrote: there is a lot of people who votes down just because they think "that's bad" when they don't actually have a clue of what it is being said / shown.
M.D.V.
That would seem to indicate that the article didn't explain things clearly enough.
CQ de W5ALT
Walt Fair, Jr.PhD P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Nelek wrote: there is a lot of people who votes down just because they think "that's bad" when they don't actually have a clue of what it is being said / shown.
M.D.V.
That would seem to indicate that the article didn't explain things clearly enough.
CQ de W5ALT
Walt Fair, Jr.PhD P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Maybe they should try saying it thrice...
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|
|
Sadly, a lot of people down-vote because they can't just copy'n'paste your code into their app and it magically works how they want it to work.
|
|
|
|
|
This should have been copy and pastable. Of course the file is big.
I think maybe people didn't understand the TryReadXXXX vs TrySkipXXXX vs TryParseXXXX methods.
Or maybe they've never used a Stream or TextReader before so they don't know what to do with a character represented as an int (or -1 if end of input)
I don't know. It's probably one of my most used classes (at least for non-trivial projects)
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.
|
|
|
|
|
Obligatory CommitStrip[^]
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Dave Kreskowiak wrote: and it magically works how they want it to work
But, but, that's the definition of good code !
|
|
|
|
|
When I voted for you, it sent it to 4.24 stars!
I think this is a very useful, minimum functionality parser helper that I will be using in my project.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
hey, thanks!
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'm working on a parser generator that is LL(k) which should be suitable for really complex grammars. Probably even C#7 (I hope - Microsoft's C# parser is hand rolled recursive descent IIRC, not generated)
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.
|
|
|
|
|
Overall, SW development must have much more silent masterpieces than modern art.
|
|
|
|
|
Welcome to CodeProject.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
back in my really young uni days I used to hand roll not so much parsers but tokenisers using a finite state machine (in C). used it for some advanced comp.sci projects
.
was about 20 lines of code (for everything), and a hand rolled a table.
tokenising a programming language such as C the table was maybe 30 rows.
handled all the language foibles (unary operators, ++, --, * as pointer vs multiplication, &...
this was when machines were pretty slow and system memory ws measured in kilobytes - this method blew away anything else in both speed and size.
kept a [hard]copy for years but eventually lost it quite some time ago.
After uni it was one of those really great tools only used once in a blue moon - (like that fancy german brand jigsaw in the tool box - bought for a project and it did the job really well but now rarely seen outside of it's box.)
OTOH I do find myself often analysing [programming] data flow/processing as sort-of finite state doodles on scrap paper.
Message Signature
(Click to edit ->)
|
|
|
|
|
Cool. I wrote similar in C#
Here: A Regular Expression Engine in C#[^]
and here: How to Make an LL(1) Parser: Lesson 2[^]
The latter one is really barebones. The former one, especially with graphviz installed, pretty much rocks.
It does non-backtracking regex primarily used for tokenizers. The API is *very* full featured, almost to the point of being confusing in the same way that an airplane cockpit is confusing.
It does runtime and compile time code generation (both array based and jump table based switches)
The latter link is just enough to illustrate the principles of one.
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.
|
|
|
|
|
They might not like your bracing and indent styles.
|
|
|
|
|
Ctrl-A, Ctrl-K, Ctrl-D reformats a code document in visual studio
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.
|
|
|
|
|
Maybe they dont like your formatting like multiple cases in one line, or missing braces and new lines.
Yesterday I discussed on work that the 100% correct solution isnt the optimal solution, because it may take too much time and so block more important jobs.
Life is too short too waiste it
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I mean, Ctrl-A,Ctrl-K,Ctrl-D will fix that in visual studio (there's similar in Monodevelop i think)
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.
|
|
|
|