Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

VIATRA2/Examples/VTCL/Terms

< VIATRA2‎ | Examples‎ | VTCL
Revision as of 09:46, 17 February 2009 by Daniel.varro.gmail.com (Talk | contribs) (Logical Terms)

VTCL Terms and Expressions

Logical Terms

Logical terms consist of usual binary Boolean operators such as "&&" (and), "||" (or), "xor" (exclusive or), and unary operator "!" (not).

The precedence of Boolean operators are as follows: "!" (highest), "&&", { "||"; "xor" } (lowest). Operator precedence can be overridden by parenthesis. All previous operators tie as usual (to the left)

Equality (and inequality) operators, namely, "==" (equal), and "!=" (not equal), are also allowed for Boolean values.

There are two logical constants: "true" and "false".

machine logical_operators{
 rule main() = seq {
	print(!true);
	print(!false);
	print(true && false);
	print(true || false);
	print(true xor false);
	print(true == true);
	print(false != true);
	// The internal pairs of parenthesis are not needed
	print((true && false) || (true  && true));
	print((true == true) != false));
	// The internal pairs of parenthesis are needed
	print((true || false) && (true  ||  false));
	print(true == (true != false));
 }
}

Arithmetic Terms

Back to the top