How do I study about GP programming language

Issue #426 resolved
cường phạm ngọc created an issue

Hi,

I find that Microblocks very useful for programming Mirocontroller by drag and drop method. I want to customize some UI on Microblocks IDE. So my question is that where can I find documentation for GP programming language. It seems to be rare on Internet.

Thanks so much

Comments (10)

  1. John Maloney repo owner

    Unfortunately, there is not much documentation on GP on the internet -- or anywhere!

    GP never caught on as its own programming language and then the GP project morphed into the MicroBlocks project.

    However, the syntax is documented here:

    https://wiki.microblocks.fun/en/gp_syntax

    It's not too difficult to figure out how to change the IDE by looking at the source.

    Hope that helps!

  2. cường phạm ngọc reporter

    Thanks John,

    It seems to be quite clear when I read code. However, due to missing document, I want to ask about the difference between to func and method func

    Sorry if it I bother you

  3. John Maloney repo owner

    A method (defined with "method") is associated with a class. Multiple classes can have a method with the same name. The actual method that is run is determined by the first argument of the method call. For example, the classes List and Dictionary both have a "count" method that returns the number of elements they contain. When "count" is called with a List as its argument then the List method is run and when it called with a Dictionary as its argument the Dictionary method is run.

    All methods must take at least one argument, and the first argument is used to decide what method to run.

    In contrast, a function defined with "to" is global. There can be only one global function with a given name. Unlike methods, a global function can have zero arguments. For example, "pi" is a function that returns the constant pi.

    A function can have the same name as a method. When such a function is called, if the first argument's class has a method of that name, then that method is run. If the first argument's class does not include a method of that name, then the global function is run.

    This design allows global functions to provide default behaviors for classes that don't implement that method. For example, the GP Morphic framework defines a set of default hander functions (that typically do nothing) for mouse and keyboard events. Morph handler classes that want to handle a given event override the default event handler by defining a method of the same name to handle that event.

    That's a lot of details. Hope it is useful!

  4. John Maloney repo owner

    There is also a no longer maintained blocks-based programming environment for of GP that runs in the browser:

    https://gpblocks.org

    That might be a good way to get started with GP.

  5. John Maloney repo owner

    I'm going to mark this issue resolved, but feel free to continue to post comments to it.

    Good luck in your explorations of GP.

  6. cường phạm ngọc reporter

    Hi,

    @Peter Mathijssen can you send me a Discord invitation again?

    @John Maloney Will MicroBlocks still support browser environment?

    Thanks all

  7. John Maloney repo owner

    MicroBlocks is built using GP but it uses GP to create a different programming language, the MicroBlocks language. Most of the GP development environment is omitted from MicroBlocks, but both systems use the Morphic graphics framework.

    Unfortunately, I do not have time to continue to develop GP itself, but you can still run it on the gpblocks.org website and the source code is available in case anyone wants to fork it and continue to work on it.

  8. Log in to comment