Pages: 1 2 3 4 5 »
  Print  
Author Topic: Subject  (Read 11983 times)
Offline (Male) Josh @ Dreamland
Posted on: July 21, 2009, 09:27:47 PM

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

View Profile Email
I told a2h to rag on me to post what I've done each day.
Don't get your hopes up though; I'm not updating the stupid 'completed functions' page.

Recent activities include collecting all my work from the last few months and organizing them into the same root directory.
What's basically happening is I'm hooking up the Expression evaluator, CFile Parser, Syntax Checker, and EDL Parser up to the Compiler, regardless of what's done and what's not.
This will, ideally, allow me to get them all working together and add on as I go.

I've also begun a large-part recode around the original EDL Parser. It has to be done at some point. Why? Well...

It's a somewhat-known fact that the EDL Parser is written in GML. A lot of you are thinking "wtf" right now. I wrote the parser, then exported it, and parsed it to C++ with itself. And it worked. (With the addition of function names around each script it parsed).

It instantly gained at least a tenfold speed increase, but that's not enough.
(Not to mention parsed GML is plug ugly; NO comments, which is 1% less than the 'desired' percentage of comments I normally leave, and no whitespace or structure)

Basically, the idea's brilliant, but the code's a bit sluggish and eww since it used to be GML. Was the ultimate benchmark, but now things need to be implemented that GML can't describe.

Please take the next couple minutes to get over the fact the parser is/was GML. Read on when you're ready.


Moving on, then, the new parser will not use < to indicate tokens in its stream. Instead, it will add a couple more letters for equally fast, less ambiguous indexing.

Scripts were scoped into each object that used them in R3. In R4, they will be defined in the global scope, and will be passed this. (The C++ loose-equivalent of id) This corrects a problem where with (a) scrname() doesn't work. You probably didn't notice.

Also, localv is being changed to local in light of Yoyo deciding that global var a; was a good idea. Now you can say local var a;, which is about as useless as saying self.varname, but is useful for saying local int a; or local double a; and not wasting all that space and time. (Though not much of either, really.)


Those who pay attention and have decent footing between these two languages know that you will now have the entirety of C++ at your disposal. If you really wanted, you could #include <iostream> and cout << "something";. Unless I decide that I'm going to maintain checking for assignment operator, in which case you'd have to say something stupid before it with an =. Haha.


There's another chunk of work I'm not looking forward to, which involves the new format. We've added basically every resource to the format, but this doesn't mean they all work yet. I'll derive background from sprite, but sound is gonna be a pain in the arse.


Another change, for those with good footing in C++, is that string() will not be a function anymore. GML fans,  don't panic: Saying string() will still work. The difference is purely technical; string() will be a constructor of a new datatype.
I had a problem with var that prohibited me from taking int as an argument type, which hindered efficiency. The new string class should fix that problem. It will be derived from std::string, with some additional namespace magic to prevent screwups.

If anyone really needs me to explain the details of that, I can, but I'm not going to unless someone asks.



In other other news, I'll be continuing development on Linux. Most of you know ENIGMA works on Linux now. Since the OS is more picky with things--for instance, file name capitalization--I think it'd be a good idea to move to it. And file names aren't the extent of it; big GCC, as in, the GCC which is not minimalist or for Windows and likely has the majority of GNU devs on its case, offers more precise error checking and warns on more things. Which is nice, as it prevents errors down the road.


Anyway, I'ma get back to working on the compiler. I have to find my new instance system and put it in the shell folder. After it's at a good stop point, I'm wiping the SVN and reuploading everything. (Makes it easier switching back and forth between platforms).


No news on ENIGMA's LibOGC frontend.

Cheers. A2h will hopefully make me edit this tomorrow. Maybe even post new.
« Last Edit: July 23, 2009, 11:22:05 AM by Josh @ Dreamland » 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 (Unknown gender) Game_boy
Reply #1 Posted on: July 22, 2009, 04:44:24 AM
Member
Joined: Apr 2008
Posts: 228

View Profile
Is there going to be any part of the final thing that'll be the same as it was in R1 ? (:P)
Logged
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: July 22, 2009, 10:47:21 AM

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

View Profile Email
Next to no part of R3 was the same as R1. R3 didn't have a line of code in the same place as R1, but a diff would have shown that it wasn't more than 30% changed. R4, though... Probably not.

Rusky once called the RX releases 'Proof-of-concept', and I kind of like the term. And as I'm thinking of more concepts to prove, and fixing up the old things... Most of the code just isn't going to last.

ENIGMA used to be C, which means that some of the code still uses malloc() instead of new[]. (And then still fewer frees it with delete[] even after allocating with malloc XD). Things like that didn't make it to R3; only survived R2 because they worked. And I've thought of better ways to do certain things each progressing release (scripts in R1 probably didn't even work. R2's had some glitches, R3's didn't work in with()... R4's will be, so far as I can see right now, flawless).

ENIGMA's such a big project that it's impossible not to get better at things as you work on it. And as you get better, you notice how bad your old code was, you get a great feel for the big picture, and you think of ways to make even trivial things more efficient. I like being able to say I've paid attention to detail as far as efficiency goes. And even though no matter what I do wrong, it'll never be as slow as GM, I want to keep it as fast as possible.


Thinking back to the first release, how disoriented I was hooking everything together... There was so much that interacted with and depended upon so much else... I wanted to just lie down and quit. Couldn't follow it all in my head. I ended up blindly following the original plan without giving any question to what was going on, and it worked. Since then, I have no problem, as you can see, gutting the entire project and putting it all back together. It's even taking less time to do things.
« Last Edit: July 22, 2009, 10:53:55 AM by Josh @ Dreamland » 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 #3 Posted on: July 22, 2009, 06:36:51 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I pretty much do the same thing.  I like to keep things consistent, and when I find something better than what I used to do, I edit everything else to do the same thing.  I used to use "i+=1" in all my scripts.  I changed them all manually to "i++" because my opinion changed from "why do I care" to "hey, it's faster."

And while you don't have to update the completed functions list, at least update it when R4 is released.

Local is good.  It's always nice to have the default as an option to set, even when it does nothing normally.  Will (local) and (global) typecasting be possible?

And here's an idea - debug mode makes console applications, which cout information about the functions run (similar to how Code::Blocks compiles all debug projects as console), and LGM can set an optional logfile to store the information in.  Plus, closing the console will instantly kill the process, so if the window freezes, you can still easily exit.  Just displaying the function and the argument values would be plenty, since you could easily know what lines were executed in case a fatal error happens.
« Last Edit: July 22, 2009, 06:44:43 PM by RetroX » 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 #4 Posted on: July 22, 2009, 09:45:44 PM

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

View Profile Email
Retro:

Debug mode will hopefully utilize that expression evaluator I made.
Currently debug mode will offer some additional error checking, such as adding strings to integers.

I don't understand how casting to the global scope would work, really.
As in GM7, you can declare a global by saying
Code: [Select]
global var a;ENIGMA will just add local to that for things like this:
Code: [Select]
global var a;
local int b;
global double c;


Anyway.
Today's standings:

I've called this function basically every bad word in my vocabulary. It needs to keep track of scope for when you say "using", which totally fucks the simplistic find-replace structure of my parser in the ass.

Parser strips and stores strings now, and successfully removes all whitespace and comments. This was going to be the only major change, and it's proving to be just as big a pain as I thought it would.

The goal of what I'm doing right now is to set up what I call a syntax map, which is a copy of the code kept in a separate string, only where varnames, numbers, statements (such as if), declarators (such as var), etc, are each given a separate letter to represent them.

This is the same thing the original parser did, only I've condensed it, and am doing a couple things slightly different for improved efficiency.

The problem is figuring out whether the current name I've run into is just a name, or if it's a declarator like var. Checking if it is var is easy, but C++ brings classes to the table, so I need to be able to check if the user has declared a class by that name, too. Overall, it is a huge pain in the ass.
« Last Edit: July 22, 2009, 09:49:51 PM by Josh @ Dreamland » 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 #5 Posted on: July 23, 2009, 11:18:13 AM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
GM doesn't actually support "global var", but rather a new keyword "globalvar". It's rather stupid, but if you use the global/local system you could just add globalvar as an alias for backwards compatibility.

On the parser... those problems are why people use recursive decent and LR parsing and stuff instead of find-replace.
Logged
Offline (Male) RetroX
Reply #6 Posted on: July 23, 2009, 12:30:41 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I don't understand how casting to the global scope would work, really.
unsigned int x; // x is unsigned int
x=(signed int)x; // x is signed int

unsigned int x; // x is unsigned int
x=(signed)x; // x is signed int

local int x; // x is a local int
x=(global int)x; // x is a global int

local int x; // x is a local int
x=(global)x; // x is a global int
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 #7 Posted on: July 23, 2009, 12:59:19 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Wow, you described the syntax for casts. Amazing.
Casting changes something's type, not its scope. Changing the scope of a variable doesn't make any sense. The only thing I can think of is that you're trying to access a global variable x when you're shadowing it with a local variable x. That wouldn't be a problem for casting, but rather for ::.
Logged
Offline (Male) Josh @ Dreamland
Reply #8 Posted on: July 23, 2009, 05:38:53 PM

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

View Profile Email
*facepalm*

global int x = x;
local int x = x;

alternatively

global.x = x;
local.x = x;

But both of those will end up being var.
« Last Edit: July 24, 2009, 01:26:51 AM by Josh @ Dreamland » 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) Josh @ Dreamland
Reply #9 Posted on: July 24, 2009, 01:26:55 AM

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

View Profile Email
Today's standings:
Getting ass raped by preprocessors.
Code: [Select]
var a =
#if somemacro
  0;
#else
  20;
#endif

Don't get me wrong, that's a SHITTY way to do ANYTHING. But because it CAN be done, I have to accommodate it. And that just sucks.
The question left by the above piece of code is, should they not use them, HOW DO I ADD SEMICOLONS TO THAT?
The only way to take care of it is to go all out on my expression evaluator and have it evaluate #if. That way, I don't rely on GCC for that part.

#pragma will result in a PEBKAC exception, or will be moved to the DESIGNATED resource for such bull.
#define will probably be #undefine'd after the piece of code they are used in. This is mostly to remove confusion in cheap hacks, by eliminating them entirely.

And this sort of rage is why I never post progress XD
The general public isn't used to the fact that when I am flaming something like that, it's because I'm enjoying myself and am intrigued by a problem.
Consider it a way of not only venting, but also recollecting based on what's known to not work, process-of-elimination style.
This is nothing I can't handle. (I hope. Just believe it.)
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) notachair
Reply #10 Posted on: July 25, 2009, 12:46:23 AM

Definitely not a chair
Contributor
Joined: Feb 2008
Posts: 299

View Profile
bump
Logged
Offline (Unknown gender) score_under
Reply #11 Posted on: July 25, 2009, 10:22:36 AM

Member
Joined: Aug 2008
Posts: 308

View Profile
Quote from: Josh @ Dreamland link=topic=298.msg2125#msg2125 date=1248416815
[code
var a =
#if somemacro
  0;
#else
  20;
#endif
[/code]

Don't get me wrong, that's a SHITTY way to do ANYTHING.
Code: [Select]
void DecodeProc2(FILE* fileM_,
unsigned int narc,
unsigned int FileZoomPos,
char*filename
#ifndef DLL
,FILE*fsend
#endif
)
{
My code.
And I don't see any way around it, apart from passing NULL to it, which would kill me from the inside knowing that I'd committed such a crime, or repeating the function definition, which is silly and unnecessary.

Also the argument names have been renamed countless times due to collisions with other variables... you should see one of my other functions, I have 2 variables and the only difference between their names is the position of their capital letter.
« Last Edit: July 25, 2009, 10:25:39 AM by score_under » Logged
Offline (Unknown gender) luiscubal
Reply #12 Posted on: July 25, 2009, 03:15:06 PM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
@score_under You are probably doing something wrong. I don't mean the preprocessor, but the variable names. No matter what you do, names should always be kept relevant. If you have collisions, then maybe you're not doing it the best way? For C++ class code, fields are often prefixed with "m_" to avoid those conflict problems.
Passing NULL as argument isn't a crime. 2 variables with such small difference in their names, however, is.
Logged
Offline (Male) Josh @ Dreamland
Reply #13 Posted on: July 25, 2009, 10:30:55 PM

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

View Profile Email
Luis-- score_under's a C programmer. If he has collisions, it's because what he's doing is so unforgivingly complicated that he needs that many variables.

score_under:
That's the less ugly way. There is an alternative, though, which is what I would have used instead in my example.
Code: [Select]
#ifndef DLL
  #define filearg_if_not_a_dll, char*filename
#else
  #define filearg_if_not_a_dll, char*filename
#endif

void DecodeProc2(FILE* fileM_,
unsigned int narc,
unsigned int FileZoomPos,
char*filename
                 filearg_if_not_a_dll)
{

But overall, people consider that a gruesome mutilation of the language, I imagine.





As for progress, it's anyone's game. Meaning. I'm tossing some ideas back and forth with Ism, who will be gone this week anyway. But basically, what we've done now is isolated which groups of keywords will have to be uniquely tokenized. (This grouping is changing a lot since I'm now supporting C++. When it was just the C basics and some GML, there was no need for this kind of reordering. Now there is.)
« Last Edit: July 25, 2009, 10:32:51 PM by Josh @ Dreamland » 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) Josh @ Dreamland
Reply #14 Posted on: July 26, 2009, 10:51:54 PM

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

View Profile Email
Today's progress:
Got the syntax map working with basic tokens, and the rest of it is still being planned out.
The simplistic find-and-replace style of the original parser will no longer cut it, due to this trinket:

Code: [Select]
struct type
{
  int value;
  type& operator int() { return value; }
}

type a;
a.value = instace_nearest(x,y,object0); //This sets the 'value' member of 'a'
a.b = c; //This pretends 'a' is an integer, treats it like an id, and thus sets object0.b to the id of whatever the nearest object0 was

Depending on the practicality of your thoughts and your knowledge of C++, you're either saying "oh boy, can't wait", "who cares", or "he'll never pull it off".

Maybe one of you is thinking "good luck," but somehow I don't think so. sadface

That assessment will be based on whether the class you named has a method of casting as int, and whether or not it contains a member by that name. This was a real no-brainer scenario. Not sure what to do if someone says

Code: [Select]
struct a {} b;
b.a=0;

Will probably try to throw a syntax error.
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
Pages: 1 2 3 4 5 »
  Print