ENIGMA Forums

General fluff => Announcements => Topic started by: Josh @ Dreamland on June 16, 2009, 02:26:59 PM

Title: Expression Evaluator complete.
Post by: Josh @ Dreamland on June 16, 2009, 02:26:59 PM
I'm pleased to inform that the expression evaluator is working just as I'd hoped.
I'd like it to have a public test.

There are two versions. The C++ one, and the GML one. The C++ one is for macros, and so does not allow strings or floats. (Numbers that aren't integers.) Also as per preprocessors, it doesn't allow casts. (Though, there is a cast system implemented.)
This means that 5/2 = 2.
The GML one does allow strings and floats. It should work just like you're used to.

Note that functions and variables aren't in yet. It's an expression evaluator. It's designed for #if. Variables will be treated as zero. I just overkilled it a bit so I could more easily make a full fledged interpreter later on.

Other changes include that ternary exists, and there are more than two string comparison operators.
(("str"=="str")?"true":"false")+"zor" is my favorite string test.
Also, note that single quotes are treated as numbers in C++, and I think I left them that way in the GML one. So 'str' is a number, "str" is a string.

This means one less step on my todo list. One more item checked off.

Those who wish to try it out can download it here:
Both as 7z / as zip
C++ as 7z / as zip
GML as 7z / as zip
When the window pops up, you are immediately allowed to type. You can clear the screen by typing c or cls, and close it by typing x. (And pressing enter.)


Anyway, I'm going back to the CFile parser now, which I've been told by many is the impossible task for one person with no tools. But I don't care what they think. ^_^

Also, feel free to keep guessing at the secret from last topic.
I'll be working.
Title: Re: Expression Evaluator complete.
Post by: Game_boy on June 17, 2009, 11:46:13 AM
On the GML one:

1=1
Error at 2: can't assign to that

1==1
1
Title: Re: Expression Evaluator complete.
Post by: Rusky on June 17, 2009, 03:54:51 PM
Stupid GM with its context-specific expression/statement crap...
Title: Re: Expression Evaluator complete.
Post by: RetroX on June 17, 2009, 04:18:50 PM
On the GML one:

1=1
Error at 2: can't assign to that

1==1
1
Does that mean it works on the C++ one, or you just mentioned it because it's GML which allows that?
Title: Re: Expression Evaluator complete.
Post by: Josh @ Dreamland on June 17, 2009, 09:20:53 PM
Yeah, I didn't really put much thought into converting it to GML. I just flipped a couple macro values.
Either way, nice catch. Noted for whenever this is applied to debug mode. And since this evaluates just the expression part, not the actual assignment operator, it'll be as simple as replacing that error with treating it as a comparison.
Title: Re: Expression Evaluator complete.
Post by: Game_boy on June 18, 2009, 12:53:12 AM
"Does that mean it works on the C++ one, or you just mentioned it because it's GML which allows that?"

The latter. I thought the GML one wouldn't recognise "=", but as Josh said it's just the standalone evaluator that doesn't.
Title: Re: Expression Evaluator complete.
Post by: RetroX on June 18, 2009, 07:51:54 AM
And on that note, I think using a single = in ENIGMA when compiling doesn't work either. >_>
Title: Re: Expression Evaluator complete.
Post by: Game_boy on June 18, 2009, 10:21:08 AM
And on that note, I think using a single = in ENIGMA when compiling doesn't work either. >_>

Yeah, that's a bit more serious. The majority of existing GM projects use "=" rather than "==" I think.
Title: Re: Expression Evaluator complete.
Post by: score_under on June 18, 2009, 03:22:41 PM
Yeah, that's a bit more serious. The majority of existing GM projects use "=" rather than "==" I think.
People who do that instantly go down on my assimilate-as-soon-as-possible list.
Title: Re: Expression Evaluator complete.
Post by: Josh @ Dreamland on June 18, 2009, 09:02:26 PM
I only replace them in if()'s and the like.
I find that a=b=c=0 is too damn useful to dispose of. I'll probably end up option-izing it.
Title: Re: Expression Evaluator complete.
Post by: whaddsoft on June 20, 2009, 08:44:05 PM
Also, feel free to keep guessing at the secret from last topic.
I'll be working.

Are the games actually going to be posted on Steam?
Title: Re: Expression Evaluator complete.
Post by: Game_boy on June 21, 2009, 06:24:39 AM
Also, feel free to keep guessing at the secret from last topic.
I'll be working.

Are the games actually going to be posted on Steam?

That's not only impractical, but also Steam does not run on Linux and has restrictive DRM.
Title: Re: Expression Evaluator complete.
Post by: Rusky on June 21, 2009, 08:18:57 PM
They're going to be making YoYo steam though
Title: Re: Expression Evaluator complete.
Post by: Josh @ Dreamland on June 21, 2009, 09:26:04 PM
Yoyo's going to be making everything, just ask them.
Title: Re: Expression Evaluator complete.
Post by: IsmAvatar on June 22, 2009, 11:47:14 AM
Yeah, that's a bit more serious. The majority of existing GM projects use "=" rather than "==" I think.
People who do that instantly go down on my assimilate-as-soon-as-possible list.

Then there's the Pascal syntax.
if (a = b) then begin
 b := 2;
end;

Valid GML syntax, valid Pascal syntax.
Title: Re: Expression Evaluator complete.
Post by: whaddsoft on June 22, 2009, 12:57:23 PM
Also, feel free to keep guessing at the secret from last topic.
I'll be working.

Are the games actually going to be posted on Steam?

That's not only impractical, but also Steam does not run on Linux and has restrictive DRM.
Well, I thought of this because when you click "Creations" at the top of the page, it says:
Quote
Coming soon... in Valve Time.

-a2h
Title: Re: Expression Evaluator complete.
Post by: Game_boy on June 22, 2009, 03:29:13 PM
Well, I thought of this because when you click "Creations" at the top of the page, it says:
Quote
Coming soon... in Valve Time.

-a2h

This may help.

http://developer.valvesoftware.com/wiki/Valve_Time

It's a joke because Valve never release anything at the stated time. a2h borrowed the joke; I don't think he intended to suggest it'll be related to Steam at all. I'm guessing EDC will be done when i) they've coded it fully and ii) ENIGMA is ready for the world to see.

Title: Re: Expression Evaluator complete.
Post by: RetroX on June 22, 2009, 08:13:43 PM
Speaking of which, everyone completely ignored the fact that I coded a useless function that nobody cares about. (http://enigma-dev.org/forums/index.php?topic=286.msg1945#new)

Yay.
Title: Re: Expression Evaluator complete.
Post by: notachair on June 23, 2009, 04:32:19 AM
This may help.

http://developer.valvesoftware.com/wiki/Valve_Time

It's a joke because Valve never release anything at the stated time. a2h borrowed the joke; I don't think he intended to suggest it'll be related to Steam at all. I'm guessing EDC will be done when i) they've coded it fully and ii) ENIGMA is ready for the world to see.
This.
Title: Re: Expression Evaluator complete.
Post by: nbeerbower on June 24, 2009, 10:48:54 AM
EDC's coming back? :D