iXML Community Group Test Suite

21 Jun 2022 (20 Aug 2022)

Top-level catalog for tests in the iXML Community Group Test Suite.

Tests have been contributed from several sources, but the core of the test collection are the tests contributed by Steven Pemberton in December 2021.

Misc tests 2

28 Jun 2022

Grammars 21-40.

Test grammars compiled manually in 2018 and 2019, re-packaged in 2022.

Added test cases where needed and moved to ixml test collection, June 2022.


Created 08 Feb 2022 by cmsmcq

Grammar for the toy programming language Tosca.

From Susan Stepney, High integrity compilation: a case study. Hemel Hempstead: Prentice Hall International, 1993. Web edition. Tosca is defined in chapter 4; the concrete syntax is specified using Z, not using a grammar, and leaves some things undefined, so the grammar given here is a bit of a reconstruction.

Invisible XML Grammar

{ program is defined in section 4.8 }
program: S, decl**S, S, cmd, S.

{ Names are described in 4.3 but left indeterminate syntactically;
I've made them like the SGML reference concrete syntax. }
NAME: letter, namechar*.
-letter:  ["a"-"z"; "A"-"Z"].
-digit: ["0"-"9"].
-namechar:  letter; digit; ["-"; "."; "_"].

{ Types are described in 4.3 }
TYPE:  "int"; "bool".
boolean:  "true"; "false".
number:  digit+.

{ declarations:  section 4.4 }
decl:  NAME, S, -":", S, TYPE, S, -";".

{ operators, section 4.5 }
unaryOp: negate; not.  

negate: "-".
not: "not".

binaryOp: plus; minus; less; greater; equal; or; and.  
plus: -"+".
minus: -"-".
less: -"<".
greater: -">".
equal: -"=".
or: -"or".
and: -"and".

{ expressions:  4.6 }
expr:  constant; variable; unaryExpr; binaryExpr.
constant:  number; boolean.
variable:  NAME.
unaryExpr:  unaryOp, S, expr.
binaryExpr:  -"(", S, expr, S, binaryOp, S, expr, S, -")".

{ commands:  4.7 }
cmd: (skip; block; assign; choice; loop; input; output).
cmdseq: (cmd, S, -";", S)+.
skip: -"skip".
block:  -"begin", S, cmdseq, -"end".
assign: variable, S, -":=", S, expr.
choice: -"if", S, condition, S, -"then", S, iftrue, -"else", S, iffalse.
condition: -expr.
iftrue: cmd.
iffalse: cmd.
loop: -"while", S, expr, S, -"do", S, cmd.
input: -"input", S, NAME.
output: -"output", S, expr.

{ Stepney does not specify whitespace or comment rules. }
-S: (ws; comment)*.
-ws: -[#20; #0A; #09; #0D].
comment: -"/*", nonstar*, ("*", nonstarnonslash*)*, -"*/".
nonstar: ~["*"]. 
nonstarnonslash: ~["*"; "/"]. 

Test case: g33.r03

Repository URI: …/tests/misc/misc-021-040-catalog.xml

Input string (297 characters)

	n : int; sq : int; limit : int;
	     n := 1; sq := 1;
	     input limit;
             output sq;
             while ( n < limit ) do
                  sq := sq + 1 + n + n;
                  n := n + 1;
                  output sq;

Expected result

The input does not match the grammar.