• Login or register

discuss.effbot.org

  • Popular
  • Recent
  • 2 points by effbot 1 year ago on Simple Top-Down Parsing in Python 1 child

    I stumbled upon that myself recently, but in that case, it was sufficient to treat the postfix operators as "modifiers" -- just let the operator's "led" method modify the left node, and then return that node instead of itself. More extensive tree modifications are also possible, but is more work.

    • parent
    • reply
    • 1 point by thenendo 1 year ago 0 children

      Excellent suggestion, thanks. In my case the solution was to have the postfix "led" make a copy of its "left" argument, then modify the original to have a new "id", signifying the postfix operation, with the copy as its "first" argument. Works beautifully.

      • link
      • reply
  • Widget
  • Recent Comments
  • Leaders
Powered by