Wiris

Documentation

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • WirisQuizzes

      • LearningLemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Miscellaneous

                      • Wiris Integrations

                        • Home
                        • MathPlayer
                        • Getting Started on a Translation
                        • Some info about the files
                        • Some info about the files

                        File Syntax

                        Reading time: 1min

                        Here is some information about the syntax of rules. You do not need to know this -- it is only for informational purposes for the curious who have some programming background. The pattern matcher works on a tree and finds the first match it can in a file. The pattern matcher tries to match a node in the input tree and if it finds a rule that matches, produces an output node. Nodes have a name, can have attributes (name/value pairs), and can have children. In general, a rule looks like

                        nodeName ? boolean tests
                         => newNodeName(children) {attribute values}
                        

                        An example from

                        UIWord ? (ruleRef=="RR_simpleSuperScript" )
                        => UIInput(string{text=(::verbosity < ::v_full) ? "to the" : "raised to the";})
                         { ruleRef="RR_simpleSuperScript"; };
                        

                        In this example, the nodeName is "UIWord" and we are testing its "ruleRef" attribute is the string "RR_simpleSuperScript". If it is, then we generate a new tree node named "UIInput" with the child named "string". String has a text attribute whose value depends upon the value of the global variable "verbosity". "UIInput" has the attribute named "ruleRef".

                        A lot of the syntax is based on C/C++ and is similar to Java and Javascript. One piece of syntax that is used a lot in the rules is the conditional operator

                        condition ? value-if-true : value-if-false
                        

                        The example above uses it to return different strings to speak depending on the values of the global variable "verbosity".

                        Note that all global variables are accessed using the "::" syntax as in "::verbosity".

                        Was this article helpful?

                        Give feedback about this article

                        Related Articles

                        • Autoformat
                        • Formula into Plotter Area
                        • Symbols
                        • Target Group

                        Empowering STEM education

                        MathType

                        • Office Tools
                        • LMS
                        • XML
                        • HTML

                        WirisQuizzes

                        Learning Lemur

                        Integrations

                        Solutions

                        • Education
                        • Publishing houses – platforms and interactive
                        • Publishing houses – Print and digital
                        • Technical writers

                        Pricing

                        Downloads

                        Blog

                        • Success stories

                        About us

                        • Careers
                        • Partnership

                        Contact Us

                        Contact Sales

                        European union (European Regional Development Fund) and 1EdTech (TrustEd Apps Certified)
                        • Cookie Policy
                        • Terms of Use
                        • Privacy Policy / GDPR
                        • Student Data Privacy
                        • Compliance
                        • Cookie Settings

                        © Wiris 2026

                        Expand