- //a class without extends
- class TestSystematic {
-
- //test member definition
- Int member;
-
- //Test function without parameter
- Null functionNoPar() {
- }
-
- //Test functions with one parameter
- Null functionOne(Int x) {
- }
-
- //Test functions with two parameters
- Null functionTwo(Int x, Int y) {
- }
-
- //Test statements
- Null testStat() {
- while (a == b) {
- a;
- b;
- c;
- }
-
- type name = init;
- name = init;
- a == b;
- printInt(1);
- printChar(1);
- }
-
- Null testIf() {
- if (a) b;
- if (a) b else d;
- }
-
- //Test the factors
- Null testFactors() {
- ident;
- 123;
- "hello";
- true;
- false;
- this;
- null;
- readInt;
- readChar;
- (a);
- {
- a;
- };
- {
- a;
- return b
- };
- new Test();
- new Test(a, b, c);
- factor.ident;
- factor.ident();
- factor.ident(a, b, c);
- }
-
- //test syntactic sugar
- Null syntaxSugar() {
- true;
- false;
- a || b;
- if (a) b;
- {};
- "abcd";
- }
-
- //test operator precedence
- Null operatorPrec() {
- a + b * c;
- a + b * -c;
- (a+b) * c;
- -(a+b) * c;
- a == b + c * d && e;
- }
-
-
-
-
- }
-
- //a class with extends
- class Systematic2 extends Systematic {
-
- }
-
- foobar.main()