ENIGMA's Progress: Parser, Resources

Posted by JoshDreamland on Oct. 22, 2007, 7:18 p.m.

Dylan and I have remained at work on our ENIGMA (It's the new Game Maker, for those who don't frequent my blogs).

<script type="text/javascript"> obj = document.getElementsByTagName('span'); ind2 = -1; for (i=0;i<obj.length;i++) { if (obj.innerHTML.indexOf("JoshDreamland's") != -1) { ind2 = obj; i = obj.length; } } if (ind2 != -1) { ind2.innerHTML = ind2.innerHTML.replace("JoshDreamland's","Josh @ Dreamland's"); } </script>

So far, a lot of progress has been made. Great leaps, imo.

Dylan has a nice looking interface, kinda exactly like GM so far. I made the background for it, as well as a logo.

Screenshot:

<a href="http://www.willhostforfood.com/files/168143/ENIGMA_Interface.PNG.png"><img src="http://www.willhostforfood.com/files/168143/ENIGMA_Interface.PNG.png" width=640>

[Click for bigger image]</a> (no additional load time)

Also, the hugeass logo render is here:

<a href="http://www.willhostforfood.com/files/91087/ENIGMAlogo.PNG.png">[click for logo]</a>

Dylan has also implemented the Sprite, Background, Sound, and Font classes, and is currently going for objects. Go Dylan!

What was I doing while Dylan was getting all this done?

From what I have to show you, nothing.

What I have is called a parser. For those who don't know, it takes GML of even the crappiest kind, reads through it, and outputs it as more C++ friendly code. For example,

if a=0instance_destroy()

parses right into:

if (a=0)
instance_destroy();

Pure. Unadulterated. Win.

Of course, that example took me an hour to finish the framework for. I had it working at one point, but it stopped. But now, it works again.

Also for example, the draw code to my Metroid game.

<a href="http://www.willhostforfood.com/files/214/UNPARSED.TXT.txt">Unparsed code</a>

<a href="http://www.willhostforfood.com/files/28338/PARSED.txt">Parsed code</a>

So as you can see, we have been busy.

If you have any large codes for me to try my parser on, PLEASE gimme a link. To a text file.

Or if it's a small ugly one like my first example, just post it.

That is all.

Opinions/Comments/Questions welcome.

END [hc=14444]

Comments

shad0w 17 years, 1 month ago

So this will take GML and convert it to C++, which will then be compiled? Why not just force C++, but with the ease of the GM interface and object/event system. 100x easier. Keep your converter as a guide for people trying to convert their projects.

Anyway, you will still need an interpreter for some of the features in the other blog- you should not bother with those until later in my opinion.

So how is progress on the library? This will be the hardest part to mimic- there are so many functions, a few very easy to rip, but the rest hard and some impossible without an interpreter- and don't say you will get them in, because then there will be source code in the non-debugger version exe :S

Good luck with this anyway, I will be interested to see how far this goes ;)

bendodge 17 years, 1 month ago

Here's some pretty messy code.

//gives the user a menu for reskinning
var i,menu,temp;
menu="";

//generate file array
files[0]=file_find_first("*_skin.ini",fa_readonly+fa_archive+fa_hidden);
for (i=1; string(files[i-1])!=""; i+=1)
    {
    files[i]=file_find_next();
    }
file_find_close();

//generate the menu string from array
ii=i;
for (i=0; i<ii; i+=1)
    {
    temp=files[i];
    menu += string_delete(temp,string_length(temp)-3,string_length(temp)) + "|";
    }

//get rid of blank entry
menu = string_delete(menu,string_length(menu)-1,string_length(menu));
//replace underscores with spaces
menu = string_replace_all(menu,"_"," ");

i=show_menu_pos(window_get_x()+mouse_x,window_get_y()+mouse_y,menu,-1);

//write settings to file and restart
if i != (-1)
    {
    ini_open("main_settings.ini");
    ini_write_string("Main","skin_name",string(files[i]));
    ini_close();
    game_restart();
    }

sirxemic 17 years, 1 month ago

if some_script("if 8 < x") (1001928).hue += (7-x)

Will that get parsed correctly too?

F1ak3r 17 years, 1 month ago

I hope ENIGMA isn't one of those gay acroynyms that spell real words. I hate those.

DFortun81 17 years, 1 month ago

@C-Ator9: Die. Just die. Not everyone hates clones, that's just an over generalization. As for ENIGMA being a clone: It's not going to be a clone of GM, it's just starting out that way. By the time the first release comes out, I'm hoping it will look much different, but for the time being, we don't have all that much to consider revising. If you have any suggestions for the layout, post an image of what you want the design to look like and we'll take it into consideration.

@C-Actos's 2nd post: We will do our best to make that possible.

@F1ak3r: It could have been worse. xD

DFortun81 17 years, 1 month ago

@bendodge:

Quote:
//generate the menu string from array

ii=i;

for (i=0; i;

menu += string_delete(temp,string_length(temp)-3,string_length(temp)) + "|";

}
You'd get a syntax error even in GM with that there piece of code. xD

JoshDreamland 17 years, 1 month ago

All right. I'ma make sure about the (id).whatever. This actually spikes the attention requirement of both parser and system.

Rest assured. We will find a way. Dylan agreed with me that the parser will play a key role in that as well as other aspects of GML conversion. It is NOT, by ANY MEANS, just a beautifier.

Speaking of which, Bendodge, your code is syntactically incorrect. But, here it is after parse:

var i,menu,temp;
menu="";
files[0]=file_find_first("*_skin.ini",fa_readonly+fa_archive+fa_hidden);
for (i=1;
string(files[i-1])!="";
i+=1)
{
files=file_find_next();
}

file_find_close();
ii=i;
for (i=0;
i;
menu+=string_delete(temp,string_length(temp)-3,string_length(temp))+"|";
}
;
menu=string_delete(menu,string_length(menu)-1,string_length(menu));
menu=string_replace_all(menu,"_"," ");
i=show_menu_pos(window_get_x()+mouse_x,window_get_y()+mouse_y,menu,-1);
if (i!=(-1));
{
;
ini_open("main_settings.ini");
ini_write_string("Main","skin_name",string(files));
ini_close();
game_restart();
}
;

but if you fix that code, I'll show you how it looks. ;)

As for your code, C-ator, well…

if (some_script("if 8 < x")(1001928).hue+=(7-x)

LOL OWNED. IT WORKED. SORT OF.

*does a dance*

JoshDreamland 17 years, 1 month ago

if (some_script("if 8 < x"))
(1001928).hue+=(7-x);

Fix'd.

bendodge 17 years, 1 month ago

Oops, I forgot that I was modifying that script. I must've subconsciously assumed that it was OK because I had compiled a working version just before that. But anyway, your parser seems pretty robust. :)

Are you still needing icons? I sketched some concept icons the other day, but I'm no good at making digital versions. I'll stick them on here when I get scanner access if you want.

s 17 years, 1 month ago

@Shadow=From what I know,things like string_execute will be left where they should be,in the bloated interpreter that likes to lag with silly functions

@Josh=you could get Ben's code if you delete his comment

The main thing to make sure with the parser is that it doesn't highlight what it won't read,because that is how someone knows if their code is alright or not.How I dread GM's file_text being highlighted(along with make_color and the like)