Pages: 1 2 3 4 5
Author Topic: Fresh Topic  (385,775 Views)
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #45 Posted on: August 22, 2009, 01:34:27 AM
Well, hey, if any of you experts want to show me how it's done, feel free. When your parser can outperform mine, I'll use it. It's that simple.

Until then, however, we'll be sticking with what I'm coding.
Offline (Unknown gender) score_under

Member
Joined: Aug 2008
Posts: 308
View profile
Reply #46 Posted on: August 24, 2009, 12:46:06 AM
Quote from: miky on August 21, 2009, 05:14:18 PM
Good thing you like fake, hard-coded, inflexible, unreadable, take-forever-to-write parsers.
Okay, let's pick that apart...
Fake? It parses. There's no fake about it, and I can see no possible way for a working parser to be fake.
Hard-coded/Inflexible? How do you make a fully-customizable parser, then? Why would you need to?
Unreadable? You must have never touched a programming language before.
Take-forever-to-write? Josh chooses how long Josh programs.

Good thing I like trolls.
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #47 Posted on: August 24, 2009, 01:48:27 PM
It doesn't parse. Parsing means analyzing, and you can only really say that of the CFile parser and maybe the syntax checker. The main translator doesn't understand anything it looks at, it just sticks semicolons in.

It is a lot more hard-coded than if it were based on a grammar. If you look at a parser written using yacc or antlr, you'll see that it's a lot less hard-coded than what Josh is doing. The grammar that his accepts is implicit in the code that's also doing other stuff. With a generator, you see the grammar explicitly and it's much faster and less bug-prone to change things.

Unreadable- compared to an actual grammar definition.
Take-forever-to-write- Yes, Josh chooses, but it will take him longer if he has to manually build a parser for a grammar that he hasn't really written down than if he just writes the grammar and uses a generator to build an LR table. It'll also be more bug-prone because when he makes modifications he's doing it at a lower level.

Good thing we're not trolls.
Offline (Unknown gender) score_under

Member
Joined: Aug 2008
Posts: 308
View profile
Reply #48 Posted on: August 24, 2009, 06:35:33 PM
Wikipedia says:
In computer science and linguistics, parsing, or, more formally, syntactic analysis, is the process of analyzing a text, made of a sequence of tokens (for example, words), to determine its grammatical structure with respect to a given (more or less) formal grammar.

That's pretty much what it does. Reads through the "tokens" (variables, operators, numbers, etc) and determines the structure - without which it is completely impossible to insert the semicolons.

And by the way, modifications at a lower level does not equal bug-prone. I have proved this many times.
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #49 Posted on: August 24, 2009, 06:40:40 PM
It doesn't determine the structure, though. At least most of the time. Usually it just looks for tokens that shouldn't be next to each other.

Modification at a lower level does equal bug-prone. Maybe you're exceptionally good at manually converting higher-level constructs to lower-level representations, but not everyone is, and you are a human, so you're definitely not as good as a computer. A computer is also much faster at it.
Offline (Unknown gender) score_under

Member
Joined: Aug 2008
Posts: 308
View profile
Reply #50 Posted on: August 24, 2009, 06:42:22 PM
Quote from: Rusky on August 24, 2009, 06:40:40 PMModification at a lower level does equal bug-prone. Maybe you're exceptionally good at manually converting higher-level constructs to lower-level representations, but not everyone is
I must admit I have had a lot of practice.
Offline (Unknown gender) Micah

Resident Troll
Joined: Jun 2008
Posts: 128
View profile
Reply #51 Posted on: August 26, 2009, 11:52:34 PM
It is a fact that you cannot change, no matter how hard you try, that it is easier, faster and less bug-prone to write or to change a description of a parser containing only the information that will need to be changed, the grammar, than to write or to change code in a parser hard-coded around the grammar.
Offline (Unknown gender) score_under

Member
Joined: Aug 2008
Posts: 308
View profile
Reply #52 Posted on: August 28, 2009, 06:07:39 PM
Quote from: miky on August 26, 2009, 11:52:34 PMit is easier, faster and less bug-prone
Sounds like an insurance ad.
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #53 Posted on: August 29, 2009, 10:47:54 PM
I love Geico ads.
Offline (Unknown gender) score_under

Member
Joined: Aug 2008
Posts: 308
View profile
Reply #54 Posted on: August 30, 2009, 01:19:41 PM
Quote from: Rusky on August 29, 2009, 10:47:54 PM
I love Geico ads.
I would probably love them if we had them in England.
Offline (Unknown gender) RetroX

Master of all things Linux
Contributor
Joined: Apr 2008
Posts: 1,055
View profile
Reply #55 Posted on: August 30, 2009, 04:03:31 PM
Quote from: Rusky on August 24, 2009, 01:48:27 PM
It doesn't parse. Parsing means analyzing
No; analyzing means analyzing.  Parsing means parsing.

Aww, I was beaten to it.  EIther way, does Josh's methods use tokens?  Yes.  Does it use a token tree?  No.
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #56 Posted on: August 31, 2009, 11:23:30 PM
Quote from: wikipediaparsing, or, more formally, syntactic analysis, is the process of analyzing a text
Analyzing means parsing; parsing means analyzing.

Either way, we already knew Josh's method didn't use a token syntax tree.
Offline (Unknown gender) RetroX

Master of all things Linux
Contributor
Joined: Apr 2008
Posts: 1,055
View profile
Reply #57 Posted on: September 01, 2009, 01:53:33 AM
It's still tokens.  Just not the kind of tokens you're thinking of.
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #58 Posted on: September 01, 2009, 12:36:43 PM
What the heck does that mean? Using tokens has nothing to do with whether or not it's parsing it. Besides, it is the kind of tokens I'm thinking of. variable names are tokens, keywords are tokens, symbols are tokens, etc...
Offline (Unknown gender) score_under

Member
Joined: Aug 2008
Posts: 308
View profile
Reply #59 Posted on: September 01, 2009, 04:09:08 PM
Quote from: Rusky on September 01, 2009, 12:36:43 PM
What the heck does that mean? Using tokens has nothing to do with whether or not it's parsing it. Besides, it is the kind of tokens I'm thinking of. variable names are tokens, keywords are tokens, symbols are tokens, etc...
The kind of tokens you were thinking of were arranged in a tree, not linearly.
Pages: 1 2 3 4 5