To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationSyntactic sugar

YASS features a ton of things that make it easier than ever to learn to program. One of the most obvious features is the option to add syntactic sugar to code.

Syntactic sugar is the principle of putting in syntax (or words) to help make code more readable. YASS focuses on this with a ton of syntaxes but also offers a less readable, faster-to-write version of the same syntax.

In fact, the C syntax featured in YASS allows for this - some people may find this syntax easier to understand than the YASS language base and therefore the option is there.

The When-Is statement (case statement) featured in YASS is a perfect example of a construct that offers syntactic sugar as an option with do keyword:

YASS
when ($x)
  is 0 do
    print("Zero")
  is 1
    print("One")
  is 2 do
    print("Two")
end when
  

Notice that the inclusion and removal of the keyword do within the 2nd and 4th lines.

This is optional to allow the use of syntactic sugar when desired and omitted when not.

In theory, syntactic sugar has very little performance impact but it has not been overly tested. The reason that it has little impact in theory only is because of the way the compiler is built. The only area of the ZPE engine in which there will be a small, neglible performance hit is with the parser which will need to lex one extra symbol.

Comments
Code previewClose
Feedback 👍
Comments are sent via email to me.