[Python] How to parse a function with ply in Python? [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to parse a custom programming language using PLY in Python, and I'm a bit confused.

    For example, I want to parse:

    on create:
    modifyProp relative width => 11
    modifyProp height => 14


    I want to make the on part work like def and then read the next part as an input (in this case create), and then parse the : like in Python.

    I also want to make the modifyProp part in the same way, with relative being read as a parameter instead of an input if it's included, and then reading => as a "change this to" command, then reading the integer.

    How can I do that?

    Continue reading...

Compartilhe esta Página