Prototype for replacement formula parser/interpreter/compiler #300
Replies: 5 comments 11 replies
-
I did a bunch of hacking last night -- I don't know why I enjoy hacking on parsers, interpreters and compilers so much So far all values are of type double and not complex. Using complex values will not implement parsing at all, only the interpreter and the JIT compiler. What's interesting is that the SSE2 registers used by the assembly language are wide enough to hold two doubles and can be used to implement something like complex add in a single instruction. If I remember correctly, in one of the Intel manuals they have a SIMD implementation of complex multiply in a few instructions. So extending the compiler to handle complex values doesn't feel like a significant complication. The remaining syntactical elements to complete the parsing are:
I've been implementing the interpreter and compiler for each element as I extend the parser. This keeps everything working without the parser getting ahead of the interpreter or the compiler. All the details of parsing, interpreting or compiling are isolated with the |
Beta Was this translation helpful? Give feedback.
-
Once this is fully working, the next major challenge is to convert "normal" fractals into perturbation code to help gain the speed that it offers at high precision. Is this possible? has anyone tried it? It wouldn't be too difficult for polynomials, but trig functions would be very difficult. Just a thought. |
Beta Was this translation helpful? Give feedback.
-
Will this new parser be easily to upgrade to double-double, quad-double and arbitrary precision? This would be a real bonus as the Fractint parser ran out of steam at about 10^14. It might be worth looking at the class structure for the variables. ManpWIN uses the following structure for the parser variables:
|
Beta Was this translation helpful? Give feedback.
-
Another benefit of the parser replacement is that it would no longer be necessary to "hand optimize" out constant subexpressions in your iteration section into the initialization section by introducing new variables. It should be a simple matter of identifying constant subexpressions in the iteration section and automatically create new variables to compute those expressions in the initialization section. Honestly, I never quite understood the data structure used by the existing parser. To dig deeper into some of the formula related bugs I would need to reverse engineer it. Since I wanted to replace it anyway, as listed on the roadmap for Id 4.0, integrating this version into the code will tick off that item. It will also be easier to do things like introduce more datatypes ( This new parser is really going to be a big step forward. |
Beta Was this translation helpful? Give feedback.
-
Id then becomes a truly revolutionary program. Well done. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've wanted to replace the bespoke formula parser and associated data structure for some time now. My first presentation to Utah C++ Programmers from 10 years ago was about a parsing framework from the boost libraries called Spirit. The June 2025 Utah C++ Programmers presentation was about JIT Code Generation with AsmJit where I used the successor parsing library Boost.Parser.
I've taken the code I created for that presentation and started extending it to support the full syntax of formulas as used in Iterated Dynamics in my formula-compiler repository on GitHub. This will let me continue to expand the grammar to handle more and more of what constitutes a formula in Iterated Dynamics and deploy it when it supports everything in the current parser. Then I will be able to extend it even further to support parsing of UltraFractal formula files.
This relates to the following open issues:
Beta Was this translation helpful? Give feedback.
All reactions