Jump to content


Photo

Mathematical Logical Parser V2 {Studio}


  • Please log in to reply
38 replies to this topic

#1 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 26 March 2014 - 04:38 PM

ML Parser - Mathematical Logical Parser
By Paul Weijtens
updated:26/06/2014

Version: Gamemaker Studio
Download: zip archive 1.5 MB
License: GNU General Public License
Source: google code
Version: 2.1.0
Downloads to older versions may be found at the google code page


Mathematical Logical Parser is an extension/scripts which enable you to execute external user-inputted code without relying on the hideous execute_string, or external dlls (such as for LUA). The perfect use of this would be for an in game console. The code from the console would then be parsed by this parser.
Another use is in user-created maps. In such a map there might be certain triggers, which are programmed by the creator of the map. The execution (and condition checking) of those triggers is a perfect application of ML parser. Other implications range from a calculator, to analyzing data.
Version 2 is a direct successor to MLP_Parser 1, a version for Gamemaker 8.1. The goal hasn't change since.

For those who are still unsure what this can do, a small test should convince you!

ML Parser rests on 2 big pillars which shaped the engine
ML Parser is robust
This means that ML Parser is safe from errors, and errors on the end user part are handled gracefully without breaking the program. This is an huge advantage over execute string: as typos are always possible when adding a console.

ML Parser is safe
This means that code executed by ML Parser is "safe". It does exactly as much as you allow ML Parser to do. And there is no possibility to do malicious things such as code injection. Or retrieving your valuable game resources in another way. You as programmer have full power over which variables are editable/readable.


Other key features
  • based around the Shunting yard algorithm for fast execution
  • independent of dlls, so portable to any platform gamemaker is working (from iphones to gm4mac & gm4win)
  • Complete safe; YOU register the function which can be used, and the syntax checker prevents anything else
  • Robust exception handling; If the input expression isn't a valid expression, an "exception" is raised. Not leaking memory and not crashing your program
  • Many default operators; over 50 operators defined, 3 categories and a dozen build-in functions.
  • easy to extend; you can add your own functions and operators with simple functions
  • Compiling Compile once, execute many times. As a rule of the thumb: if you expect to execute an expression more than 1.5 times on average compile it!
  • ...
Plans for future
The first thing on the list I will add now are probably variables, to allow custom user variables I'd have to reserve another series of keywords. Probably "varreal" and "varstring" will be the keywords.
  • Ability to let users define variables & use them
  • Ability to "compile" but not execute functions (in 2.1)
  • Extra user types (references/objects/arrays)
  • Ability to optimize compilations
Change log
v2.1.0
  • Added ability to compile & execute
  • Added function ML_Interpret() for clarity - and new syntax
  • Moved results to their own object (ResObj) that is returned by the functions
  • The expression to parse is no longer part of the parser but an argument to the functions
  • Some minor (and major) speed improvement by using GM:Studio accessors.
v2.0.1
  • Small bug fix in operator handling
v2.0.0
  • Initial release
I hope with these script set people can improve their games, if you have any suggestions or remarks I'll be more than happy to receive them! As always posting a comment here for appreciation is very well liked, and helps motivating me for future development.
  • 12

#2 VirtuCity

VirtuCity

    VirtuCity Co-Creator

  • GMC Member
  • 609 posts
  • Version:GM8

Posted 26 March 2014 - 04:52 PM

This sounds awesome! I am definitely checking this out. But 1 question, what about commercial games ?


  • 0

8tO5PfD.png 


#3 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 28 March 2014 - 12:44 PM

Thanks for the appreciation :). I'd gladly help you if you run into trouble.

As for commercial games: sure you can use it. Just remember that this is GPLed software; so your source has to be available. I spent hundreds of hours to make this extension and make it bug free. I'm providing it for free in the complete sense - the least I can expect is that others do the same with things they create.
  • 2

#4 rater193

rater193

    GMC Member

  • GMC Member
  • 127 posts
  • Version:GM:Studio

Posted 27 April 2014 - 10:57 PM

this is amazing, finally, modability is added back to my GM games, since gms updated to studio ive been trying to find an alternative to execute_file well this is DEFINITLY a gr8 alternative :)


  • 0

Click this to find out what you are!

Posted Image


#5 Sirosky

Sirosky

    GMC Member

  • GMC Member
  • 1601 posts
  • Version:GM:Studio

Posted 27 April 2014 - 11:35 PM

Neat! I've gotta check this out.


  • 0

gcjRa8D.png


#6 thijsmie

thijsmie

    GMC Member

  • GMC Member
  • 29 posts

Posted 19 May 2014 - 07:32 PM

Ooohw this is very well done! One little remark on the installation though, you realize when you rightclick "scripts" in Gamemaker Studio you can select "Add existing script". You then can just select all the scripts from folder. Of course you lose the folder structure, which is probably why you didn't mention this method, but whatever.


  • 0

#7 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 03 June 2014 - 07:41 AM

Neat. It have almost everything I need. It will be good to have such features:

1. Exectuting string like 'VarNew = 5' will automatically create a new var. I tried writing

    if ML_VM_HasNoPVar(global._ML_CURRENTPARSER_, argument1)
    {
        if is_real(argument2)
            ML_AddVariable(global._ML_CURRENTPARSER_, argument1, argument2, ML_VAL_REAL, 0)
        else
            ML_AddVariable(global._ML_CURRENTPARSER_, argument1, argument2, ML_VAL_STRING, 0)
    }

to the _ML_FAssign function, but it didn't helper. Well, I didn't really expected it to work so easily anyway cause you wrote this in TODO list already.

 

2. I wonder if I can write operator what will allow to change instance's variables or read them. At least those, that you pre-defined before. Like 'SomeId.x = 100'.


  • 0

#8 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 12 June 2014 - 01:12 PM

As for creating new variables "on the fly" - this isn't supported yet. However it is possible - in a quite roundabout way. What you basically do is create a FUNCTION that allows to create variables on the fly. So that a user would add the following line (to create a variable with the name varname). - Notice that it is a string, if not a string was used the "lexer" (the thing converting text to internal functions/variables/etc would complain that the name does not exist yet:

declare_var("varname", 0)
Then the function createnewvar would be a function such as:

///declare_var_script(name, value)

var name = argument0;
var value = argument1;
if is_real(argument2) {
    ML_AddVariable(global._ML_CURRENTPARSER_, name, value, ML_VAL_REAL, false);
} else {
    ML_AddVariable(global._ML_CURRENTPARSER_, name, value, ML_VAL_STRING, false);
}
return 0;
And you would setup the parser like:

map = ds_map_create();
parser = ML_ML_InitParserEmpty(map); 
//or do whatever else you wish to initialize normally


//first version that looks like declare_var("var", 0) - creating a variable that holds a numeric value
var list = ds_list_create();
ds_list_add(li2real, ML_VAL_STRING);
ds_list_add(li2real, ML_VAL_REAL);
ML_AddFunctionArgList(parser, "declare_var", declare_var_script, ML_VAL_REAL, list);

//2nd type creating a variable that holds a string
ds_list_replace(list, 1, ML_VAL_STRING);
ML_AddFunctionArgList(parser, "declare_var", declare_var_script, ML_VAL_REAL, list);
ds_list_destroy(list);
Now there is one other quirk in this method - you can only use the variable AFTER it has been added. So you first have to let the user declare the variable - then parse the line of code and THEN in the next line the variable can be called.


As for writing an operator that handles specific instance variables - this is quite easy. I'm giving here a function - but an operator is just syntactic sugar around functions so it can be extended easily.
//the script:
///changex(id, value)
argument0.x = argument1;
return argument0.x;
//For safety I do strongly recommend checking if the id is in some "allowed id" list.
initialize:
//....

//I'd also add all the ids to a variable so that it can easily be used 
ML_AddVariable(parser, "playerid", id, ML_VAL_REAL, true); //change ids and variable name as you like

var list = ds_list_create();
ds_list_add(li2real, ML_VAL_REAL);
ds_list_add(li2real, ML_VAL_REAL);
ML_AddFunctionArgList(parser, "changex", changex, ML_VAL_REAL, list);
//and for fun a custom "operator":

ML_AddBinaryOper(parser, "setx", 2, changex, ML_VAL_REAL, ML_VAL_REAL, ML_VAL_REAL, ML_O_RIGHTASSOC);
By the gamer above would be used like:

changex(player, 100); //function way
player setx 100; //operator way





@thijsmie:
Rightclicking and dragging the files into the IDE can indeed both be done. But with so many scripts I found the folder structure to be of vital importance.
  • 0

#9 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 13 June 2014 - 05:51 AM

Hmm.. I though too about declaring variables this way, but it gives not much difference from declaring variables without a parser I think... well, for now. I think I'll need it later anyway.

As for operators - can it be styled after GM? So I won't have to remember all those additional operators. It seems it will work like player .x= 100 if I make operator ".x=", but this is just an imitation. And also - I think it won't allow to read player.x with same operator.


Edited by GamerXP, 13 June 2014 - 05:51 AM.

  • 0

#10 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 13 June 2014 - 11:57 AM

@gamerxp - to make it different would require indeed a huge rewrite of the parser (especially the error checking). It will go along the route of
var v;
- A specific identifier to declare a variable.

As for the second thing it should be possible. But just thanks to this question I discovered a very large bug in the lexer. When a new token starts with a punctuality sign (any non whitespace/alfanumeric underscore or quotation mark) the following bit of code is run to "find" the end of the word:
            l = 2;
            tstr = c;
            while (l <= string_length(str) ){
                tc = string_char_at(str,l);
                tstr += tc;
                if (!ds_map_exists(P_ASSIGNOPER,tstr) && !ds_map_exists(P_UNOPER,tstr) && !ds_map_exists(P_BINOPER,tstr) 
                    && !ds_map_exists(P_TERNOPER, tstr) && !ds_map_exists(P_TERNOPER2, tstr) ) break;
                l += 1;
            }
            l -= 1;
Now the problem is with the break condition. - It breaks when it can't find any operator that looks like the temporary string. However it does this character by character. So say you have a parser which has the "=" operator and the "=/=" operator but no other operators.

At the first step the while loop is run with "=/" as operator (l = 2) - this doesn't exist so the while loop is exited and the parser thinks the only operator was "=". Then the next non white space is found "/" - again punctuality, again it won't find "/=" - and thus it thinks the operator is "/" - which is also non existing - so an exception is raised.

In short this means that operators based on punctuality can only work as 2 sign marks. Any 3 sign operator that does not start with an alphanumeric character must have a 2 sign operator that looks like the first 2 parts.


I will try to fit in time to fix this glaring bug in a quick version. After that what you ask should be possible.
  • 0

#11 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 26 June 2014 - 03:48 PM

Ok I found time to fix this little bug (updated the main post with the new download link).
test


The lexical analysis as a consequence became a bit more complex;
Spoiler



One extra note though: an operator keyword should either contain no punction marks [.,<] etc or it should start with one.
  • 0

#12 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 01 July 2014 - 07:18 AM

Oh, nice. Hmm, hmm...

Though, I sometimes add space before "=", though I need to duplicate those commands I think. Like this:

//I'd also add all the ids to a variable so that it can easily be used 
ML_AddVariable(parser, "player", objPlayer.id, ML_VAL_REAL, true); //change ids and variable name as you like
ML_AddBinaryOper(parser, ".x=", 2, changex, ML_VAL_REAL, ML_VAL_REAL, ML_VAL_REAL, ML_O_RIGHTASSOC);
ML_AddBinaryOper(parser, ".x =", 2, changex, ML_VAL_REAL, ML_VAL_REAL, ML_VAL_REAL, ML_O_RIGHTASSOC);

ML_SetExpression(parser, "player.x = 200");

I also tried writing like:

ML_SetExpression(parser, string(objPlayer.id) + ".x = 200");

Didn't worked. But this once works fine (I just added space before .x):

ML_SetExpression(parser, string(objPlayer.id) + " .x = 200");

Weird thing you don't have to write space if you're using a var to reference to instance, but you must place it if you manually input id there like I did.

 


Edited by GamerXP, 01 July 2014 - 07:19 AM.

  • 0

#13 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 01 July 2014 - 09:19 PM

No space can't be used in any token.. it really is consider a token separator. (not doing this would make lexical analysis near impossible/magnitudes slower). Using an operator with spaces can lead to all kind of effects right now.


The only "solution" for this I might add in the future is that I would add "references" and/or objects.. But that is the far future.
  • 0

#14 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 02 July 2014 - 04:52 AM

Well, if it was me, I better not make " .  " as part of function (like .x=), but just make it work like separator. So, dot will be optional and you can write "player.x = 100" or "player x = 100". I think it's not really matter if you have dot or not since you always have to add all those "x=" etc through functions.


  • 0

#15 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 02 July 2014 - 01:33 PM

Well that wouldn't work, as it I want to let the user do anything they wish. Adding the dot sign to the "whitelist" characters simply means that it can't be used for anything else. (And custom white-list characters would really really slow down the lexer - the lexer takes already almost half the time).

In other news: I've just released version 2.1. Version 2.1 has as big feature compiling. A lot has changed under the hood to make this possible, but right now you can compile your string to bytecode. So the lexical analysis need only to be done once. This speeds up expression parsing a lot. On my (very dated) laptop I come to the following speeds: (should be much faster on modern pcs)
interpret: 0.27 ms
execute compiled: 0.050 ms
compile + exec: 0.37 ms
compile: 0.32 ms
So basically if you run on average a line more than 1.5 times, compile it!

The manual is also updated to reflect those changes.
  • 0

#16 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 03 July 2014 - 11:42 AM

Tried compiling things.. maybe it will be hard to use this feature since I think it won't compile right if variables I check don't exist at the moment of compilation. Well, got another problem. Not sure if it's on my part so I'll just write it:


Push :: Execution Error - Variable Get -1.VARMAP(101704, -1)
 at gml_Script__ML_LiRO_AddToken (line 15) -     lhs_val = ds_map_find_value(VARMAP, _ML_Li_GetName(v));
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script__ML_LiRO_AddToken (line 15)
called from - gml_Script__ML_PARSE_EvalLine (line 27) -     lhs_val = _ML_LiRO_AddToken(res_obj, lhs);
called from - gml_Script__ML_Parse (line 15) -     lhs_val = _ML_PARSE_EvalLine(parser, rpn, res_obj);
called from - gml_Script__ML_Interpret_Detail (line 38) -     ans = _ML_Parse(parser, rpn, res_obj);    
called from - gml_Script_ML_Interpret (line 9) - _ML_Interpret_Detail(parser, funcstr, resobj);
called from - gml_Object_sys_global_StepBeginEvent_1 (line 66) -                 ML_Interpret(dlParser, parse_string);

Seems it doesn't know variable VARMAP. I used extension-type MLP. Just in case, I initialized parser like this:

dlVARS = ds_map_create();
dlParser = ML_InitParserCS(dlVARS);

Edited by GamerXP, 03 July 2014 - 11:47 AM.

  • 0

#17 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 04 July 2014 - 02:29 PM

Oh my goodness did I release/link the wrong version? - updated - url should now point correctly.
In more positive news, I made an example html5 file so you can see it in work (this extension should work on all GM exports):

test
  • 0

#18 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 05 July 2014 - 07:20 AM

Hmm. It works now, good. Though, I wonder, do I always have to write "" around strings? Quotes inside qoutes look weird. Can I somehow make that parser treat unknown tokens as strings?

'var "MyVar" == 1'

PS. Var is unary operator that inits var if it doesn't exists or reads it... though I wonder if I can somwhow get that '1' values to decide which variables type I should init. I created var and svar for now.


  • 0

#19 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 05 July 2014 - 11:35 AM

Well the automatic reading won't be done until I really finalize the variable-system. (Or if I add "reference" types one can trick ML parser to do this). But even then I think the way to go will be to explicitly state var_real & var_string.

Using this (and thus having purely static types) is faster - at least until I start adding actually modern optimization techniques -, more safe and errors will be catched earlier. So no, auto type deduction is not something that is high on the agenda.
  • 0

#20 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 06 July 2014 - 09:43 AM

I just tried adding a function without arguments. Like this:

self() dir

It won't work without () after function name. Can I somehow make it so I won't have to write brackets? Well, if not - I can just always add "self" variable and automatically change it's value every time.


  • 0

#21 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 09 July 2014 - 09:15 AM

You're really threading into "uncertain" territory. But a function is identified as such because of the "argument list". And ML-parser expects a the argument list between braces.


There is however nothing stopping you from manually editing a variable (or using the ML_VM_* functions).. You can change the value of "self" at any point in a script, even if you set it to read only it just means that the user can't assign to it. It won't check your scripts.
  • 1

#22 Repix

Repix

    Goodbye!

  • GMC:Member
  • 816 posts
  • Version:GM:Studio

Posted 09 July 2014 - 09:36 AM

Thanks dude! Will definitely use this!


Take the pistol, aim the front towards yourself, pull the trigger, why? because it's not a prank gun no longer.


#23 Mark Ian

Mark Ian

    GMC Member

  • GMC Member
  • 137 posts
  • Version:Unknown

Posted 31 July 2014 - 08:51 AM

Jesus. I just stumbled over this article by chance and I am not disappointed! I have two projects of mine I was considering implementing in another language because of the issue of interpreting code in-game / in simulation (might still do that since GM:S computing power cannot compete with C and other languages) but in any case, thank you good sir for your awesomeness.


  • 0
That Obscure Object of Desire

#24 MrJackSparrow2

MrJackSparrow2

    GMC Member

  • GMC Member
  • 632 posts
  • Version:GM:Studio

Posted 27 August 2014 - 04:41 AM

Hey paul23, any updates on this? The user variables and types would really complete this project!


  • 0

#25 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 28 August 2014 - 12:17 AM

I'm not very far I'm afraid. After last update I started working on getting GMFilesystem updated - adding unicode support proved to be a much larger beast than I expected.


  • 0

#26 MrJackSparrow2

MrJackSparrow2

    GMC Member

  • GMC Member
  • 632 posts
  • Version:GM:Studio

Posted 28 August 2014 - 08:51 PM

Ah, I see. It seems you got a good bit of the unicode support working now, nice work! When time permits, will you be taking a look at this project again? I'm curious if you're dropping it or just putting it on the back burner for now.
  • 0

#27 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 28 August 2014 - 10:14 PM

I'm most definitelly not abandoning this. I just have to think about how to approach new features first a lot. - Questions like "What is the scope of variables - how long will they be in existance" (IE: will a user declared variable only exist during that single call to ML_execute, or will it persist forever in the parser). But also: "When shall I check for variable validity". Thus: should I just stop checking for existence of variables during the lexical analysis(ML_Parse) and do it "during runtime (ML_Execute)", to facilitate variables that may be declared at another position by another user script?
  • 0

#28 MrJackSparrow2

MrJackSparrow2

    GMC Member

  • GMC Member
  • 632 posts
  • Version:GM:Studio

Posted 28 August 2014 - 10:38 PM

Ah, I see the dilemma. Perhaps you can make two separate variable types? One that requires an explicit free() and another, more local, that always gets destroyed at the end of the call. If this is more work than you're going for (I can definitely understand why) perhaps require explicit freeing solely. I suppose you'd have to consider memory leaks and such, but the script writer should take care of this themselves. The technical issues with this though is redeclaration of variables. No two variables, regardless of scope, could have the same name identifier unless you mangled the names during a parse.

 

The old GM runner seemed to prefer checking validity at runtime, but that's unnecessary overhead. I think the question of "validity testing" can be better answered when you've determined how you want the scoping to work.

 

Regardless, I'm glad you haven't abandoned this! It's extremely powerful, and useful. The price can't be beat either! :)


  • 0

#29 GrixM

GrixM

    GMC Member

  • GMC Member
  • 424 posts
  • Version:GM:Studio

Posted 27 November 2014 - 04:03 PM

Found a bug in manual installation. When following the instructions, I get the error: "Script name <undefined> not allowed". I found the error, the script_insert.xml file references a script called "Bufferdecode.gml" in the folder compilation/detail/bufferdecode, but that script does not exist. It misses the ML_ prefix too.


  • 0

#30 tripl3dogdare

tripl3dogdare

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 05 March 2015 - 08:17 PM

I'm trying to use this for a small project, and I must say I'm very impressed. However, I'm having a slight problem... I've set up my parser correctly AFAIK, but when I try to parse a file with it nothing happens. I'm super confused... Does anyone have any code examples I could look at? Thanks!


Edited by tripl3dogdare, 05 March 2015 - 08:17 PM.

  • 0

#31 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 08 March 2015 - 05:54 PM

Did you read the included pdf - and check the ".gmz" file?

 

The most simplistic way to setup is simply a thing like:

VARMAP = ds_map_create();
parser = ML_InitParserCS(VARMAP);

And then you add all kind of extra things (functions, variables, operators) to it; if you have questions about those extra things please specificy more clearly "what" you want.

 

Then to execute:

ML_Interpret(parser, "3 * (3 + 1)");

OR -if you wish to execute the same line more than once-:

compiled = ML_Compile(parser, "3 * (3 + 1)");
results = ML_Execute(parser, compiled);

 

And to read the actual results:

value = ML_ResObj_GetFinalAnswer(results)

Read section 3.2 of the manual for more result getting...


  • 0

#32 tripl3dogdare

tripl3dogdare

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 08 March 2015 - 06:04 PM

Sorry, I must have been unclear - I meant examples of the parsed files...

I'm not at my computer rn, or I'd show you what I've got, but I've got my functions and such set up and I'm using basic file reading functions to run through the files, but when I try using ML_Interpret or ML_Compile/ML_Execute nothing happens.
  • 0

#33 Dragon47

Dragon47

    Mytino

  • GMC Member
  • 687 posts
  • Version:GM:Studio

Posted 08 March 2015 - 06:25 PM

This looks great. Good job!

A bit of a shame that it doesn't compile with windows YYC, but other than that it works great.

So if I've understood this correctly; if I use this collection of scripts in my game, I'll have to make the source code of my entire game available to the public?


  • 0

wfoEubT.png       BNY6m3V.png       cfwjSDg.png       jermsLg.png       WqPXsGB.png

 

Games:   Blue Void (3D horror)   Icebound (2D puzzle platformer)


#34 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 08 March 2015 - 06:54 PM

Sorry, I must have been unclear - I meant examples of the parsed files...

I'm not at my computer rn, or I'd show you what I've got, but I've got my functions and such set up and I'm using basic file reading functions to run through the files, but when I try using ML_Interpret or ML_Compile/ML_Execute nothing happens.

What do you mean by "parsed files" - what kind of file do you wish to parse, what are the contents and what do you want with it?

 

@dragon: yes, is that a problem?


  • 0

#35 tripl3dogdare

tripl3dogdare

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 08 March 2015 - 07:00 PM

 

Sorry, I must have been unclear - I meant examples of the parsed files...

I'm not at my computer rn, or I'd show you what I've got, but I've got my functions and such set up and I'm using basic file reading functions to run through the files, but when I try using ML_Interpret or ML_Compile/ML_Execute nothing happens.

What do you mean by "parsed files" - what kind of file do you wish to parse, what are the contents and what do you want with it?

 

Basically I'm running through a normal text file with the extension ".mpl" line by line, and i want to execute what it reads. Unfortunately, when I tried running it through the parser I'd set up, it did nothing.


  • 0

#36 paul23

paul23

    GMC Member

  • Global Moderators
  • 4147 posts
  • Version:GM:Studio

Posted 08 March 2015 - 07:02 PM

Well you should show me how you set it up and the exact file contents.


  • 0

#37 tripl3dogdare

tripl3dogdare

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 08 March 2015 - 07:06 PM

Nevermind - I've already started working on my own parser to solve the problem, I just wanted to try and figure it out for later. Sorry to bother you. Keep up the good work tho, it looks amazing!


  • 0

#38 Dragon47

Dragon47

    Mytino

  • GMC Member
  • 687 posts
  • Version:GM:Studio

Posted 08 March 2015 - 07:37 PM

@paul

If I were to make a commercial game, anyone could download my art, audio and code. It would be possible for others to base their own game off of my project. If someone were to take my source and just change the art and audio assets, they could distribute their game just like that, right? Or is there another reason that most commercial games decide not to have their source open to the public?


  • 0

wfoEubT.png       BNY6m3V.png       cfwjSDg.png       jermsLg.png       WqPXsGB.png

 

Games:   Blue Void (3D horror)   Icebound (2D puzzle platformer)


#39 s0lt4r

s0lt4r

    GMC Member

  • GMC Member
  • 61 posts
  • Version:GM:Studio

Posted 31 May 2015 - 09:42 PM

I'm attempting to parse variable names from files and I'm coming up empty. I'm unclear of how to evaluate variable names for their value.

 

 

 

@paul

If I were to make a commercial game, anyone could download my art, audio and code. It would be possible for others to base their own game off of my project. If someone were to take my source and just change the art and audio assets, they could distribute their game just like that, right? Or is there another reason that most commercial games decide not to have their source open to the public?

 

I believe under GPL you wouldn't have to release it for free, but honestly I'm unclear. As I understand it, the source needs to be released, but you can charge for it. Again, don't quote me on that.

 

EDIT:

 

I'm reference GM variables not ML variables.


Edited by s0lt4r, 31 May 2015 - 10:02 PM.

  • 0