PScript – Part 2 – Expressions

Part 1 defined the core control language, but we need to add expressions – both mathematical and boolean. In doing so I also want to add features that I believe will extend the usage of PScript.

Mathematical Operators

+ Addition
/ Division
* Multiplication
() Parenthesis
& Bitwise And
| Bitwise Or
<<  Shift Left
>>  Shift Right

Boolean operators

== Equal
Greater than
Less than
>= Greater than or equal
<= Less than or equal
!= Not equal
|| logical or
&& logical and

I am a bit undecided on “||” and “&&” and I consider using “or” or “and” instead to make a clearer difference to the bitwise operators. I also lack NOT and XOR yet – I need to think about those because the C syntax on these bits area a bit cryptic.

The classic “=” vs “==” is not a problem here as we don’t allow “=” inside expressions.

Leave a Reply