Pages: « 1 2 3 4 »
  Print  
Author Topic: Parsers -- A novel by Josh @ Dreamland  (Read 7878 times)
Offline (Male) RetroX
Reply #15 Posted on: August 23, 2009, 03:42:48 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
GCC does a lot, so why waste effort? GCC has a preprocessor. So why bother working on one? You could have the EDL go through the preprocessor, then your parser and THEN the C compiler itself. It could work...
The preprocessor is mostly required for syntax checking, if I recall.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #16 Posted on: August 23, 2009, 07:36:21 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
The preprocessor is what handles #preprocessor directives.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Rusky
Reply #17 Posted on: August 24, 2009, 08:52:52 AM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
If you can invoke just the preprocessor, you should do that on the EDL and then parse. That is what he was saying.

Quote from: RetroX
Which is what the parser is supposed to do!  It's not a syntax checker.  It parses Game Maker syntax into C++ syntax.  If it's not good enough for Game Maker to read, it's not going to be parsed correctly, and it won't compile.  However, if Game Maker can read it, it will be made readable by the compiler.
But it does need to give meaningful error messages when it fails.

@Josh: I have no problem with your method of converting to C++ to get compiled EDL. It's a great idea. I just think it's also a good idea to use the same ideology ("This tool has been around much longer and can definitely do the job, let's use it") and use a parser generator. It makes things so much easier, faster and clearer.
Logged
Offline (Male) RetroX
Reply #18 Posted on: August 24, 2009, 09:34:20 AM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
"This tool has been around much longer and can definitely do the job, let's use it"

Originally, the computer monitor was this big device that shot electrons out of an effing big tube onto a glass screen.  Eventually, someone was able to make a liquid crystal display, which used far less electricity to do the job, and it had a severe difference in quality from its successor.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #19 Posted on: August 24, 2009, 10:22:42 AM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
He said g++ has been around longer and thus has been improved more. That is a valid argument- we don't need to compile anything ourselves. Yacc has been around much longer than Josh, and is a computer program, so it is easier to generate correct parsers with it.

You obviously still don't understand what is going on. All Josh's parser needs to do is make the code readable by a c++ compiler. It doesn't have to actually parse it. All your analogies to florescent lights and lcd screens are completely off. The reason his method is useful is because it's doing something different- it's not doing the same thing in a different way.
Logged
Offline (Unknown gender) score_under
Reply #20 Posted on: August 24, 2009, 01:37:08 PM

Member
Joined: Aug 2008
Posts: 308

View Profile
Compiler optimizations aside, ++i is faster than i++, because i++ has to create a copy of i to evaluate to and increment the real one, while ++i just increments it.
No.

The only difference between i++ and ++i is when it is incremented - you still have to reference the variable if you are using it as part of another expression. No copies are created, either.

Rusky: Reinventing the wheel is good.
1- It allows you to improve.
2- Any bugs and you can find them pretty easily, as it's your own code
3- It's specialized. You can make your own optimizations.
4- Human-written is almost always better than auto-generated.
« Last Edit: August 24, 2009, 01:39:02 PM by score_under » Logged
Offline (Male) Rusky
Reply #21 Posted on: August 24, 2009, 01:47:41 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Reinventing the wheel is not all good.
1- It allows you to improve, but it also allows you to inadvertently create new bugs
2- Anything that can introduce new bugs is only worth it if you need something to work differently
3- Do you really need specialization?
4- You misunderstand. The specification is human-written, and the driver program is human-written. All the generator does is run an algorithm on the grammar to generate the parse tables. You should read about LR parsers. Besides, that claim is completely ridiculous. Are you saying we should all use machine code? Are you saying nobody should use EDL?
Logged
Offline (Male) Josh @ Dreamland
Reply #22 Posted on: August 24, 2009, 06:40:11 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
Doesn't matter if the spec is human-authored or not. (And for all you know, it isn't. [That was a joke; you don't have to go calling people morons over it])
ENIGMA's API is human-written. GCC's optimizer is human-written. But there are some things that only a human can optimize.

Maybe a parser's not one of them; maybe it is. It doesn't really matter to me; my way will at very, very least keep up. And considering its comparative performance to GM, Which I'm not going to bother quantifying again, I'd say it'll do much more than that anyway.

Either way, if both methods had identical output with identical speed, I would still stick to this one simply because I'm already writing it, and I'm the only one that will ever be reading it. Anyone that thinks they have the incentive can fork the project and write their own parser that does what mine can.

Until then, we're sticking to what I'm writing.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #23 Posted on: August 24, 2009, 08:08:22 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
He said g++ has been around longer and thus has been improved more. That is a valid argument- we don't need to compile anything ourselves. Yacc has been around much longer than Josh, and is a computer program, so it is easier to generate correct parsers with it.

You obviously still don't understand what is going on. All Josh's parser needs to do is make the code readable by a c++ compiler. It doesn't have to actually parse it. All your analogies to florescent lights and lcd screens are completely off. The reason his method is useful is because it's doing something different- it's not doing the same thing in a different way.
Quote
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.
Essentially, parsing is taking text from one form and putting it to another, better form.  Something as simple as BBCode is "parsed".

The lightbulb worked for hundreds of years.  Because it has worked well for that long, does it mean that it's the best?  No.

It is impossible to re-invent the wheel.  It is one of the most simplistic machines, and now that you know how to make it work, you realize that is the only way to make it work.  By making it better, you would simply be modifying the current design and adding on to it.

However, a regular light bulb is not the only way to make something work.  You can make it differently, even though you know its current design which works so well.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #24 Posted on: August 25, 2009, 08:41:59 AM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
And you still don't get the point. Even Josh knows his parser couldn't compile anything. When are you going to get that? The reason his method works is because all it has to do is modify the syntax so it's valid C++. C++ syntax is very close to GML anyway.

But your analogy doesn't make sense anyway. The lightbulb was around for hundreds of years, which is why it had time to be improved. GCC has been around for a long time, so it's had time for tons and tons of bugs to be fixed, tons of missing features to be added, and all those new additions tested as well.

Florescent bulbs are doing the same thing- putting out light. Josh's parser is not doing the same thing- it's just fixing would-be syntax errors. It doesn't even pay attention to semantics, which GCC absolutely has to.
Logged
Offline (Male) RetroX
Reply #25 Posted on: August 25, 2009, 09:51:00 AM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I... I'll just stop.  You're not getting my point, and I don't think explaining anymore is going to make you change your mind.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #26 Posted on: August 25, 2009, 10:05:04 AM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
I know what you mean. You're saying that we shouldn't just blindly use old methods because there might be better ones. But I'm saying that that doesn't apply to Josh's parser, because he's not trying to do the same thing.
Logged
Offline (Unknown gender) score_under
Reply #27 Posted on: August 25, 2009, 04:16:13 PM

Member
Joined: Aug 2008
Posts: 308

View Profile
I... I'll just stop.  You're not getting my point, and I don't think explaining anymore is going to make you change your mind.
I don't think Rusky will get any point unless it agrees with his original ideas.

It's a man thing.
Logged
Offline (Male) Rusky
Reply #28 Posted on: August 25, 2009, 05:49:57 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Haha. If what I just explained wasn't your point, you're not doing a very good job of explaining it yourself.
Logged
Offline (Unknown gender) MrJackSparrow2
Reply #29 Posted on: August 25, 2009, 10:12:46 PM
Member
Joined: Apr 2008
Posts: 35

View Profile Email
I don't have enough knowledge to fight in this argument, however could we all calm down and stop bitching at each other about what a parser does, and efficiency of methods of parsing. Frankly, I only care to read about what Josh is doing, how things are going, etcetera. I could give a damn about these stupid metaphors, and fighting over things that doesn't help Josh one bit. Can we be less like the GMC, and more of a supportive community? I know it started out in a suggestive supporting tone, but that went to hell pretty fast. Not trying to shove a stick in anybodies ass, but this fighting in every one of Josh's new topics is childish and stupid in my opinion. Don't flame me for this; as the point of this post is to stop the trolling around. Thanks.
« Last Edit: August 25, 2009, 10:18:55 PM by MrJackSparrow2 » Logged
Pages: « 1 2 3 4 »
  Print