Skip to content

Reverse Polish Notation Tips

Max Paperno edited this page Jul 10, 2022 · 1 revision

Having trouble wrapping your head around Reverse Polish Notation? I can't blame you. I've programmed in over a dozen computer languages but this one still has me scratching my head.

"Infix 2 Postfix" (and vice versa)

The Prepar3D SDK download includes a neat GUI app called Infix2Postfix.exe. "Postfix" is what they call RPN notation and "Infix" is what most humans (or at least programmers :) ) are used to. So you can write "normal looking" code and have the tool translate that to RPN, or even vice-versa (which I found very helpful when trying to figure out what some of example I've found actually do).

You can download their SDK from here, install it, then find the utility in the Panels and User Interface\Panels folder. It's a standalone EXE file (and a help .txt file) so it could be copied to some other folder and the rest of the SDK could be safely removed.

You can find a screenshot of the program at the bottom of the Prepar3D RPN reference page (which is a good read in itself).

"Silent" Errors

Not so much of a tip as an annoyance to watch out for. MSFS will happyly execute whatever "calculator code" you give it and report "success," meaning the MSFS A{O function which is being used in the background, execute_calculator_code(), returns with status of "OK" regardless of what actually happened with your code.

Meanwhile your code may not have been valid at all... and so far I've only found one place to see that actual result, which is in the MSFS "Dev Tools" Console. There you will see a bright red error warning and sometimes even some semi-useful tip for fixing the error.

If anyone know how to get actual exeuction status programmatically, I would love to hear about it.