Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

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

There are no comments on this page.

New comment

Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days.

Comments powered by BalfComment

Feedback 👍
Comments are sent via email to me.