Creating a new target for the compiler?

I've started a project for another program called GameMaker, in which I am currently writting my own language which will translate into a valid GameMaker project.

I've come to realize that my language is 99% the same as processing. So I wondered, instead of writing my own language and my own compiler, would it be possible for me to modify the processing compiler so that it compiles into another language?

My goal is to do something similar to what Trypescript, Stylus or Sass are currently doing: Code in a very nice feature-full language ( processing in this case ), then compile into the target language.

The language I'm targeting is very simple, like a very basic version of javascript. It's called GML, it's the scripting language used inside GameMaker.

Do I have the rights to modify the compiler so that it compiles into another language, and if I do, what would be the best way to start? I've never collaborated with github before ( but I used github a lot, alone ).

Thanks for anyone for giving me answers!


  • edited January 2017

    Processing already got a transpiler called Processing.js (Pjs): :bz
    It transpiles Processing Java's syntax to JS', so it runs in web browsers. \m/
    Whatever the transpilation's target is, you still gotta write the whole API for it though. #:-S

  • But it is allowed and the entire code base is free on github

  • The thing is I don't just want to generate a simili javascript language. In GameMaker, classes, methods, typing, all of those don't exists.

    My goal is to compile from a typed oop-oriented language to a script-based no typing and no classes language.

    I already know what the target structure will look like, I just need something to go from CODE A to CODE B.

    I started writting my own, but I'm having trouble in the process of validating variables and classes.

    I will take a look at ProcessingJS, maybe the bit I am missing is hidden in there :P Thanks for the link.

  • Could you say something about what the goal of this project is? Why write GameMaker Language (GML) in a Java dialect and then transpile it to a proprietary scripting language? Why not write GameMaker games in GML?

    What is your plan for the unsupported structures -- e.g., if your source uses class objects should transpiling throw a transpile error, or is your goal to create non-classed analog structures? This can get really hard.

  • GameMaker is very UI oriented. To do something simple, one must click a lot. Also, many concepts like methods in objects aren't available in gamemaker. I have to create a script, and then use some weird tricks to make it act as a method.

    I know that GML isn't meant to be used the way I want to use it, which is why I am attempting this project. The goal of my language is to provide a typed, ui-less oop language to build game using all the libraries and features of GameMaker.

    Here is a post on the game maker forums where I started my project.

  • edited January 2017 Answer ✓

    Wow, that thread provides a huge amount of useful context for this question.

    So you have already written a lexer for your C#/Java-like first draft of nGML, and now you are interested in integrating it into a forked version of the Processing IDE.

    The Processing IDE has the concept of "modes" -- default Java mode, Python mode, Android mode etc. -- which are available to install from the upper-right dropdown box on the Processing sketch window that says "Java". You could use this mechanism to create an nGML mode -- in fact, it could be the only mode present in your fork. That mode would (when you run the sketch or select "Export Application") run your lexer on the nGML in the window tabs and output the contents to GML / GameMaker files.

    Does this give you a good starting point?

  • Thank you jeremydouglass for actually taking the time to read that post.

    Yes, I was looking for something that will do the compiling part of the stuff. I guess I'll take a look at the Javascript mode to get an idea of how to convert my stuff, gml being very close to javascript in the first place.

    Again, thanks for the quick answers!

Sign In or Register to comment.