using System.Collections.Generic; using System.Numerics; using Microsoft.Boogie; using Microsoft.Contracts; namespace Microsoft.Dafny { public class Parser { const int maxT = 93; const bool T = true; const bool x = false; const int minErrDist = 2; static Token/*!*/ token; // last recognized token static Token/*!*/ t; // lookahead token static int errDist = minErrDist; static List! theClasses = new List(); static Expression! dummyExpr = new LiteralExpr(Token.NoToken); static Statement! dummyStmt = new ReturnStmt(Token.NoToken); static Attributes.Argument! dummyAttrArg = new Attributes.Argument("dummyAttrArg"); static Scope! parseVarScope = new Scope(); static int anonymousIds = 0; struct MemberModifiers { public bool IsGhost; public bool IsClass; public bool IsUse; } // helper routine for parsing call statements private static void RecordCallLhs(IdentifierExpr! e, List! lhs, List! newVars) { lhs.Add(e); if (parseVarScope.Find(e.Name) == null) { VarDecl d = new VarDecl(e.tok, e.Name, new InferredTypeProxy(), null); newVars.Add(d); parseVarScope.Push(e.Name, e.Name); } } // helper routine for parsing call statements private static Expression! ConvertToLocal(Expression! e) { FieldSelectExpr fse = e as FieldSelectExpr; if (fse != null && fse.Obj is ImplicitThisExpr) { return new IdentifierExpr(fse.tok, fse.FieldName); } return e; // cannot convert to IdentifierExpr (or is already an IdentifierExpr) } /// /// Parses top level declarations from "filename" and appends them to "classes". /// Returns the number of parsing errors encountered. /// Note: first initialize the Scanner. /// public static int Parse (string! filename, List! classes) /* throws System.IO.IOException */ { using (System.IO.StreamReader reader = new System.IO.StreamReader(filename)) { BoogiePL.Buffer.Fill(reader); Scanner.Init(filename); return Parse(classes); } } /// /// Parses top-level declarations and appends them to "classes" [sic]. /// Returns the number of parsing errors encountered. /// Note: first initialize the Scanner. /// public static int Parse (List! classes) { List oldClasses = theClasses; theClasses = classes; Parse(); theClasses = oldClasses; return Errors.count; } /*--------------------------------------------------------------------------*/ static void Error(int n) { if (errDist >= minErrDist) Errors.SynErr(n, t.filename, t.line, t.col); errDist = 0; } public static void SemErr(string! msg) { if (errDist >= minErrDist) Errors.SemErr(token.filename, token.line, token.col, msg); errDist = 0; } public static void SemErr(Token! tok, string! msg) { if (errDist >= minErrDist) Errors.SemErr(tok.filename, tok.line, tok.col, msg); errDist = 0; } static void Get() { for (;;) { token = t; t = Scanner.Scan(); if (t.kind<=maxT) {errDist++; return;} t = token; } } static void Expect(int n) { if (t.kind==n) Get(); else Error(n); } static bool StartOf(int s) { return set[s, t.kind]; } static void ExpectWeak(int n, int follow) { if (t.kind == n) Get(); else { Error(n); while (!StartOf(follow)) Get(); } } static bool WeakSeparator(int n, int syFol, int repFol) { bool[] s = new bool[maxT+1]; if (t.kind == n) {Get(); return true;} else if (StartOf(repFol)) return false; else { for (int i=0; i <= maxT; i++) { s[i] = set[syFol, i] || set[repFol, i] || set[0, i]; } Error(n); while (!s[t.kind]) Get(); return StartOf(syFol); } } static void Dafny() { ClassDecl! c; DatatypeDecl! dt; while (t.kind == 4 || t.kind == 9) { if (t.kind == 4) { ClassDecl(out c); theClasses.Add(c); } else { DatatypeDecl(out dt); theClasses.Add(dt); } } Expect(0); } static void ClassDecl(out ClassDecl! c) { Token! id; Attributes attrs = null; List typeArgs = new List(); List members = new List(); Expect(4); while (t.kind == 5) { Attribute(ref attrs); } Ident(out id); if (t.kind == 14) { GenericParameters(typeArgs); } Expect(5); while (StartOf(1)) { ClassMemberDecl(members); } Expect(6); c = new ClassDecl(id, id.val, typeArgs, members, attrs); } static void DatatypeDecl(out DatatypeDecl! dt) { Token! id; Attributes attrs = null; List typeArgs = new List(); List ctors = new List(); Expect(9); while (t.kind == 5) { Attribute(ref attrs); } Ident(out id); if (t.kind == 14) { GenericParameters(typeArgs); } Expect(5); while (t.kind == 1 || t.kind == 5) { DatatypeMemberDecl(ctors); } Expect(6); dt = new DatatypeDecl(id, id.val, typeArgs, ctors, attrs); } static void Attribute(ref Attributes attrs) { Expect(5); AttributeBody(ref attrs); Expect(6); } static void Ident(out Token! x) { Expect(1); x = token; } static void GenericParameters(List! typeArgs) { Token! id; Expect(14); Ident(out id); typeArgs.Add(new TypeParameter(id, id.val)); while (t.kind == 12) { Get(); Ident(out id); typeArgs.Add(new TypeParameter(id, id.val)); } Expect(15); } static void ClassMemberDecl(List! mm) { Method! m; Function! f; MemberModifiers mmod = new MemberModifiers(); while (t.kind == 4 || t.kind == 7 || t.kind == 8) { if (t.kind == 7) { Get(); mmod.IsGhost = true; } else if (t.kind == 4) { Get(); mmod.IsClass = true; } else { Get(); mmod.IsUse = true; } } if (t.kind == 11) { FieldDecl(mmod, mm); } else if (t.kind == 29) { FunctionDecl(mmod, out f); mm.Add(f); } else if (t.kind == 16) { MethodDecl(mmod, out m); mm.Add(m); } else Error(94); } static void FieldDecl(MemberModifiers mmod, List! mm) { Attributes attrs = null; Token! id; Type! ty; Expect(11); if (mmod.IsUse) { SemErr(token, "fields cannot be declared 'use'"); } if (mmod.IsClass) { SemErr(token, "fields cannot be declared 'class'"); } while (t.kind == 5) { Attribute(ref attrs); } IdentType(out id, out ty); mm.Add(new Field(id, id.val, mmod.IsGhost, ty, attrs)); while (t.kind == 12) { Get(); IdentType(out id, out ty); mm.Add(new Field(id, id.val, mmod.IsGhost, ty, attrs)); } Expect(10); } static void FunctionDecl(MemberModifiers mmod, out Function! f) { Attributes attrs = null; Token! id; List typeArgs = new List(); List formals = new List(); Type! returnType; List reqs = new List(); List reads = new List(); List decreases = new List(); Expression! bb; Expression body = null; Expect(29); if (mmod.IsGhost) { SemErr(token, "functions cannot be declared 'ghost'"); } while (t.kind == 5) { Attribute(ref attrs); } Ident(out id); if (t.kind == 14) { GenericParameters(typeArgs); } parseVarScope.PushMarker(); Formals(true, formals); Expect(13); Type(out returnType); if (t.kind == 10) { Get(); while (t.kind == 20 || t.kind == 30 || t.kind == 31) { FunctionSpec(reqs, reads, decreases); } } else if (StartOf(2)) { while (t.kind == 20 || t.kind == 30 || t.kind == 31) { FunctionSpec(reqs, reads, decreases); } FunctionBody(out bb); body = bb; } else Error(95); parseVarScope.PopMarker(); f = new Function(id, id.val, mmod.IsClass, mmod.IsUse, typeArgs, formals, returnType, reqs, reads, decreases, body, attrs); } static void MethodDecl(MemberModifiers mmod, out Method! m) { Token! id; Attributes attrs = null; List! typeArgs = new List(); List ins = new List(); List outs = new List(); List req = new List(); List mod = new List(); List ens = new List(); Statement! bb; Statement body = null; Expect(16); if (mmod.IsUse) { SemErr(token, "methods cannot be declared 'use'"); } while (t.kind == 5) { Attribute(ref attrs); } Ident(out id); if (t.kind == 14) { GenericParameters(typeArgs); } parseVarScope.PushMarker(); Formals(true, ins); if (t.kind == 17) { Get(); Formals(false, outs); } if (t.kind == 10) { Get(); while (StartOf(3)) { MethodSpec(req, mod, ens); } } else if (StartOf(4)) { while (StartOf(3)) { MethodSpec(req, mod, ens); } BlockStmt(out bb); body = bb; } else Error(96); parseVarScope.PopMarker(); m = new Method(id, id.val, mmod.IsClass, mmod.IsGhost, typeArgs, ins, outs, req, mod, ens, body, attrs); } static void DatatypeMemberDecl(List! ctors) { Attributes attrs = null; Token! id; List typeArgs = new List(); List formals = new List(); while (t.kind == 5) { Attribute(ref attrs); } Ident(out id); if (t.kind == 14) { GenericParameters(typeArgs); } parseVarScope.PushMarker(); if (t.kind == 22) { FormalsOptionalIds(formals); } parseVarScope.PopMarker(); ctors.Add(new DatatypeCtor(id, id.val, typeArgs, formals, attrs)); Expect(10); } static void FormalsOptionalIds(List! formals) { Token! id; Type! ty; string! name; Expect(22); if (StartOf(5)) { TypeIdentOptional(out id, out name, out ty); formals.Add(new Formal(id, name, ty, true)); parseVarScope.Push(name, name); while (t.kind == 12) { Get(); TypeIdentOptional(out id, out name, out ty); formals.Add(new Formal(id, name, ty, true)); parseVarScope.Push(name, name); } } Expect(23); } static void IdentType(out Token! id, out Type! ty) { Ident(out id); Expect(13); Type(out ty); } static void Type(out Type! ty) { Token! tok; TypeAndToken(out tok, out ty); } static void IdentTypeOptional(out BoundVar! var) { Token! id; Type! ty; Type optType = null; Ident(out id); if (t.kind == 13) { Get(); Type(out ty); optType = ty; } var = new BoundVar(id, id.val, optType == null ? new InferredTypeProxy() : optType); } static void TypeIdentOptional(out Token! id, out string! identName, out Type! ty) { string name = null; TypeAndToken(out id, out ty); if (t.kind == 13) { Get(); UserDefinedType udt = ty as UserDefinedType; if (udt != null && udt.TypeArgs.Count == 0) { name = udt.Name; } else { SemErr(id, "invalid formal-parameter name in datatype constructor"); } Type(out ty); } if (name != null) { identName = name; } else { identName = "#" + anonymousIds++; } } static void TypeAndToken(out Token! tok, out Type! ty) { tok = Token.NoToken; ty = new BoolType(); /*keep compiler happy*/ List! gt; if (t.kind == 24) { Get(); tok = token; } else if (t.kind == 25) { Get(); tok = token; ty = new IntType(); } else if (t.kind == 26) { Get(); tok = token; gt = new List(); GenericInstantiation(gt); if (gt.Count != 1) { SemErr("set type expects exactly one type argument"); } ty = new SetType(gt[0]); } else if (t.kind == 27) { Get(); tok = token; gt = new List(); GenericInstantiation(gt); if (gt.Count != 1) { SemErr("seq type expects exactly one type argument"); } ty = new SeqType(gt[0]); } else if (t.kind == 1 || t.kind == 28) { ReferenceType(out tok, out ty); } else Error(97); } static void Formals(bool incoming, List! formals) { Token! id; Type! ty; Expect(22); if (t.kind == 1) { IdentType(out id, out ty); formals.Add(new Formal(id, id.val, ty, incoming)); parseVarScope.Push(id.val, id.val); while (t.kind == 12) { Get(); IdentType(out id, out ty); formals.Add(new Formal(id, id.val, ty, incoming)); parseVarScope.Push(id.val, id.val); } } Expect(23); } static void MethodSpec(List! req, List! mod, List! ens) { Expression! e; bool isFree = false; if (t.kind == 18) { Get(); if (StartOf(6)) { Expression(out e); mod.Add(e); while (t.kind == 12) { Get(); Expression(out e); mod.Add(e); } } Expect(10); } else if (t.kind == 19 || t.kind == 20 || t.kind == 21) { if (t.kind == 19) { Get(); isFree = true; } if (t.kind == 20) { Get(); Expression(out e); Expect(10); req.Add(new MaybeFreeExpression(e, isFree)); } else if (t.kind == 21) { Get(); Expression(out e); Expect(10); ens.Add(new MaybeFreeExpression(e, isFree)); } else Error(98); } else Error(99); } static void BlockStmt(out Statement! block) { Token! x; List body = new List(); Statement! s; parseVarScope.PushMarker(); Expect(5); x = token; while (StartOf(7)) { Stmt(body); } Expect(6); block = new BlockStmt(x, body); parseVarScope.PopMarker(); } static void Expression(out Expression! e) { Token! x; Expression! e0; Expression! e1 = dummyExpr; e = dummyExpr; if (t.kind == 42) { Get(); x = token; Expression(out e); Expect(52); Expression(out e0); Expect(43); Expression(out e1); e = new ITEExpr(x, e, e0, e1); } else if (StartOf(8)) { EquivExpression(out e); } else Error(100); } static void GenericInstantiation(List! gt) { Type! ty; Expect(14); Type(out ty); gt.Add(ty); while (t.kind == 12) { Get(); Type(out ty); gt.Add(ty); } Expect(15); } static void ReferenceType(out Token! tok, out Type! ty) { tok = Token.NoToken; ty = new BoolType(); /*keep compiler happy*/ List! gt; if (t.kind == 28) { Get(); tok = token; ty = new ObjectType(); } else if (t.kind == 1) { Ident(out tok); gt = new List(); if (t.kind == 14) { GenericInstantiation(gt); } ty = new UserDefinedType(tok, tok.val, gt); } else Error(101); } static void FunctionSpec(List! reqs, List! reads, List! decreases) { Expression! e; if (t.kind == 20) { Get(); Expression(out e); Expect(10); reqs.Add(e); } else if (t.kind == 30) { Get(); if (StartOf(9)) { PossiblyWildExpressions(reads); } Expect(10); } else if (t.kind == 31) { Get(); Expressions(decreases); Expect(10); } else Error(102); } static void FunctionBody(out Expression! e) { e = dummyExpr; Expect(5); if (t.kind == 33) { MatchExpression(out e); } else if (StartOf(6)) { Expression(out e); } else Error(103); Expect(6); } static void PossiblyWildExpressions(List! args) { Expression! e; PossiblyWildExpression(out e); args.Add(e); while (t.kind == 12) { Get(); PossiblyWildExpression(out e); args.Add(e); } } static void Expressions(List! args) { Expression! e; Expression(out e); args.Add(e); while (t.kind == 12) { Get(); Expression(out e); args.Add(e); } } static void PossiblyWildExpression(out Expression! e) { e = dummyExpr; if (t.kind == 32) { Get(); e = new WildcardExpr(token); } else if (StartOf(6)) { Expression(out e); } else Error(104); } static void MatchExpression(out Expression! e) { Token! x; List cases = new List(); Expect(33); x = token; Expression(out e); if (t.kind == 5) { Get(); CaseExpressions(cases); Expect(6); } else if (t.kind == 6 || t.kind == 34) { CaseExpressions(cases); } else Error(105); e = new MatchExpr(x, e, cases); } static void CaseExpressions(List! cases) { MatchCase! c; while (t.kind == 34) { CaseExpression(out c); cases.Add(c); } } static void CaseExpression(out MatchCase! c) { Token! x, id, arg; List arguments = new List(); Expression! body; Expect(34); x = token; parseVarScope.PushMarker(); Ident(out id); if (t.kind == 22) { Get(); Ident(out arg); arguments.Add(new BoundVar(arg, arg.val, new InferredTypeProxy())); parseVarScope.Push(arg.val, arg.val); while (t.kind == 12) { Get(); Ident(out arg); arguments.Add(new BoundVar(arg, arg.val, new InferredTypeProxy())); parseVarScope.Push(arg.val, arg.val); } Expect(23); } Expect(35); Expression(out body); c = new MatchCase(x, id.val, arguments, body); parseVarScope.PopMarker(); } static void Stmt(List! ss) { Statement! s; while (t.kind == 5) { BlockStmt(out s); ss.Add(s); } if (StartOf(10)) { OneStmt(out s); ss.Add(s); } else if (t.kind == 7 || t.kind == 11) { VarDeclStmts(ss); } else Error(106); } static void OneStmt(out Statement! s) { Token! x; Token! id; string label = null; s = dummyStmt; /* to please the compiler */ switch (t.kind) { case 50: { AssertStmt(out s); break; } case 51: { AssumeStmt(out s); break; } case 8: { UseStmt(out s); break; } case 1: case 22: case 85: case 86: { AssignStmt(out s); break; } case 41: { HavocStmt(out s); break; } case 46: { CallStmt(out s); break; } case 42: { IfStmt(out s); break; } case 44: { WhileStmt(out s); break; } case 47: { ForeachStmt(out s); break; } case 36: { Get(); x = token; Ident(out id); Expect(13); s = new LabelStmt(x, id.val); break; } case 37: { Get(); x = token; if (t.kind == 1) { Ident(out id); label = id.val; } Expect(10); s = new BreakStmt(x, label); break; } case 38: { Get(); x = token; Expect(10); s = new ReturnStmt(x); break; } default: Error(107); break; } } static void VarDeclStmts(List! ss) { VarDecl! d; if (t.kind == 7) { Get(); } Expect(11); IdentTypeRhs(out d); ss.Add(d); parseVarScope.Push(d.Name, d.Name); while (t.kind == 12) { Get(); IdentTypeRhs(out d); ss.Add(d); parseVarScope.Push(d.Name, d.Name); } Expect(10); } static void AssertStmt(out Statement! s) { Token! x; Expression! e; Expect(50); x = token; Expression(out e); Expect(10); s = new AssertStmt(x, e); } static void AssumeStmt(out Statement! s) { Token! x; Expression! e; Expect(51); x = token; Expression(out e); Expect(10); s = new AssumeStmt(x, e); } static void UseStmt(out Statement! s) { Token! x; Expression! e; Expect(8); x = token; Expression(out e); Expect(10); s = new UseStmt(x, e); } static void AssignStmt(out Statement! s) { Token! x; Expression! lhs; Expression rhs; Type ty; s = dummyStmt; LhsExpr(out lhs); Expect(39); x = token; AssignRhs(out rhs, out ty); if (rhs != null) { s = new AssignStmt(x, lhs, rhs); } else { assert ty != null; s = new AssignStmt(x, lhs, ty); } Expect(10); } static void HavocStmt(out Statement! s) { Token! x; Expression! lhs; Expect(41); x = token; LhsExpr(out lhs); Expect(10); s = new AssignStmt(x, lhs); } static void CallStmt(out Statement! s) { Token! x, id; Expression! e; List lhs = new List(); List newVars = new List(); Expect(46); x = token; CallStmtSubExpr(out e); if (t.kind == 12 || t.kind == 39) { if (t.kind == 12) { Get(); e = ConvertToLocal(e); if (e is IdentifierExpr) { RecordCallLhs((IdentifierExpr)e, lhs, newVars); } else if (e is FieldSelectExpr) { SemErr(e.tok, "each LHS of call statement must be a variable, not a field"); } else { SemErr(e.tok, "each LHS of call statement must be a variable"); } Ident(out id); RecordCallLhs(new IdentifierExpr(id, id.val), lhs, newVars); while (t.kind == 12) { Get(); Ident(out id); RecordCallLhs(new IdentifierExpr(id, id.val), lhs, newVars); } Expect(39); CallStmtSubExpr(out e); } else { Get(); e = ConvertToLocal(e); if (e is IdentifierExpr) { RecordCallLhs((IdentifierExpr)e, lhs, newVars); } else if (e is FieldSelectExpr) { SemErr(e.tok, "each LHS of call statement must be a variable, not a field"); } else { SemErr(e.tok, "each LHS of call statement must be a variable"); } CallStmtSubExpr(out e); } } Expect(10); if (e is FunctionCallExpr) { FunctionCallExpr fce = (FunctionCallExpr)e; s = new CallStmt(x, newVars, lhs, fce.Receiver, fce.Name, fce.Args); // this actually does an ownership transfer of fce.Args } else { SemErr("RHS of call statement must denote a method invocation"); s = new CallStmt(x, newVars, lhs, dummyExpr, "dummyMethodName", new List()); } } static void IfStmt(out Statement! ifStmt) { Token! x; Expression guard; Statement! thn; Statement! s; Statement els = null; Expect(42); x = token; Guard(out guard); BlockStmt(out thn); if (t.kind == 43) { Get(); if (t.kind == 42) { IfStmt(out s); els = s; } else if (t.kind == 5) { BlockStmt(out s); els = s; } else Error(108); } ifStmt = new IfStmt(x, guard, thn, els); } static void WhileStmt(out Statement! stmt) { Token! x; Expression guard; bool isFree; Expression! e; List invariants = new List(); List decreases = new List(); Statement! body; Expect(44); x = token; Guard(out guard); assume guard == null || Owner.None(guard); while (t.kind == 19 || t.kind == 31 || t.kind == 45) { if (t.kind == 19 || t.kind == 45) { isFree = false; if (t.kind == 19) { Get(); isFree = true; } Expect(45); Expression(out e); invariants.Add(new MaybeFreeExpression(e, isFree)); Expect(10); } else { Get(); PossiblyWildExpressions(decreases); Expect(10); } } BlockStmt(out body); stmt = new WhileStmt(x, guard, invariants, decreases, body); } static void ForeachStmt(out Statement! s) { Token! x, boundVar; Type! ty; Expression! collection; Expression! range; List bodyPrefix = new List(); AssignStmt bodyAssign = null; parseVarScope.PushMarker(); Expect(47); x = token; range = new LiteralExpr(x, true); ty = new InferredTypeProxy(); Expect(22); Ident(out boundVar); if (t.kind == 13) { Get(); Type(out ty); } Expect(48); Expression(out collection); parseVarScope.Push(boundVar.val, boundVar.val); if (t.kind == 49) { Get(); Expression(out range); } Expect(23); Expect(5); while (t.kind == 8 || t.kind == 50 || t.kind == 51) { if (t.kind == 50) { AssertStmt(out s); if (s is PredicateStmt) { bodyPrefix.Add((PredicateStmt)s); } } else if (t.kind == 51) { AssumeStmt(out s); if (s is PredicateStmt) { bodyPrefix.Add((PredicateStmt)s); } } else { UseStmt(out s); if (s is PredicateStmt) { bodyPrefix.Add((PredicateStmt)s); } } } if (StartOf(11)) { AssignStmt(out s); if (s is AssignStmt) { bodyAssign = (AssignStmt)s; } } else if (t.kind == 41) { HavocStmt(out s); if (s is AssignStmt) { bodyAssign = (AssignStmt)s; } } else Error(109); Expect(6); s = new ForeachStmt(x, new BoundVar(boundVar, boundVar.val, ty), collection, range, bodyPrefix, bodyAssign); parseVarScope.PopMarker(); } static void LhsExpr(out Expression! e) { SelectExpression(out e); } static void AssignRhs(out Expression e, out Type ty) { Token! x; Expression! ee; Type! tt; e = null; ty = null; if (t.kind == 40) { Get(); ReferenceType(out x, out tt); ty = tt; } else if (StartOf(6)) { Expression(out ee); e = ee; } else Error(110); if (e == null && ty == null) { e = dummyExpr; } } static void SelectExpression(out Expression! e) { Token! id; e = dummyExpr; if (t.kind == 1) { IdentOrFuncExpression(out e); } else if (t.kind == 22 || t.kind == 85 || t.kind == 86) { ObjectExpression(out e); } else Error(111); while (t.kind == 80 || t.kind == 82) { SelectOrCallSuffix(ref e); } } static void IdentTypeRhs(out VarDecl! d) { Token! id; Type! ty; Expression! e; Expression rhs = null; Type newType = null; Type optionalType = null; DeterminedAssignmentRhs optionalRhs = null; Ident(out id); if (t.kind == 13) { Get(); Type(out ty); optionalType = ty; } if (t.kind == 39) { Get(); AssignRhs(out rhs, out newType); } if (rhs != null) { assert newType == null; optionalRhs = new ExprRhs(rhs); } else if (newType != null) { optionalRhs = new TypeRhs(newType); } else if (optionalType == null) { optionalType = new InferredTypeProxy(); } d = new VarDecl(id, id.val, optionalType, optionalRhs); } static void Guard(out Expression e) { Expression! ee; e = null; Expect(22); if (t.kind == 32) { Get(); e = null; } else if (StartOf(6)) { Expression(out ee); e = ee; } else Error(112); Expect(23); } static void CallStmtSubExpr(out Expression! e) { e = dummyExpr; if (t.kind == 1) { IdentOrFuncExpression(out e); } else if (t.kind == 22 || t.kind == 85 || t.kind == 86) { ObjectExpression(out e); SelectOrCallSuffix(ref e); } else Error(113); while (t.kind == 80 || t.kind == 82) { SelectOrCallSuffix(ref e); } } static void EquivExpression(out Expression! e0) { Token! x; Expression! e1; ImpliesExpression(out e0); while (t.kind == 53 || t.kind == 54) { EquivOp(); x = token; ImpliesExpression(out e1); e0 = new BinaryExpr(x, BinaryExpr.Opcode.Iff, e0, e1); } } static void ImpliesExpression(out Expression! e0) { Token! x; Expression! e1; LogicalExpression(out e0); if (t.kind == 55 || t.kind == 56) { ImpliesOp(); x = token; ImpliesExpression(out e1); e0 = new BinaryExpr(x, BinaryExpr.Opcode.Imp, e0, e1); } } static void EquivOp() { if (t.kind == 53) { Get(); } else if (t.kind == 54) { Get(); } else Error(114); } static void LogicalExpression(out Expression! e0) { Token! x; Expression! e1; RelationalExpression(out e0); if (StartOf(12)) { if (t.kind == 57 || t.kind == 58) { AndOp(); x = token; RelationalExpression(out e1); e0 = new BinaryExpr(x, BinaryExpr.Opcode.And, e0, e1); while (t.kind == 57 || t.kind == 58) { AndOp(); x = token; RelationalExpression(out e1); e0 = new BinaryExpr(x, BinaryExpr.Opcode.And, e0, e1); } } else { OrOp(); x = token; RelationalExpression(out e1); e0 = new BinaryExpr(x, BinaryExpr.Opcode.Or, e0, e1); while (t.kind == 59 || t.kind == 60) { OrOp(); x = token; RelationalExpression(out e1); e0 = new BinaryExpr(x, BinaryExpr.Opcode.Or, e0, e1); } } } } static void ImpliesOp() { if (t.kind == 55) { Get(); } else if (t.kind == 56) { Get(); } else Error(115); } static void RelationalExpression(out Expression! e0) { Token! x; Expression! e1; BinaryExpr.Opcode op; Term(out e0); if (StartOf(13)) { RelOp(out x, out op); Term(out e1); e0 = new BinaryExpr(x, op, e0, e1); } } static void AndOp() { if (t.kind == 57) { Get(); } else if (t.kind == 58) { Get(); } else Error(116); } static void OrOp() { if (t.kind == 59) { Get(); } else if (t.kind == 60) { Get(); } else Error(117); } static void Term(out Expression! e0) { Token! x; Expression! e1; BinaryExpr.Opcode op; Factor(out e0); while (t.kind == 70 || t.kind == 71) { AddOp(out x, out op); Factor(out e1); e0 = new BinaryExpr(x, op, e0, e1); } } static void RelOp(out Token! x, out BinaryExpr.Opcode op) { x = Token.NoToken; op = BinaryExpr.Opcode.Add/*(dummy)*/; switch (t.kind) { case 61: { Get(); x = token; op = BinaryExpr.Opcode.Eq; break; } case 14: { Get(); x = token; op = BinaryExpr.Opcode.Lt; break; } case 15: { Get(); x = token; op = BinaryExpr.Opcode.Gt; break; } case 62: { Get(); x = token; op = BinaryExpr.Opcode.Le; break; } case 63: { Get(); x = token; op = BinaryExpr.Opcode.Ge; break; } case 64: { Get(); x = token; op = BinaryExpr.Opcode.Neq; break; } case 65: { Get(); x = token; op = BinaryExpr.Opcode.Disjoint; break; } case 48: { Get(); x = token; op = BinaryExpr.Opcode.In; break; } case 66: { Get(); x = token; op = BinaryExpr.Opcode.NotIn; break; } case 67: { Get(); x = token; op = BinaryExpr.Opcode.Neq; break; } case 68: { Get(); x = token; op = BinaryExpr.Opcode.Le; break; } case 69: { Get(); x = token; op = BinaryExpr.Opcode.Ge; break; } default: Error(118); break; } } static void Factor(out Expression! e0) { Token! x; Expression! e1; BinaryExpr.Opcode op; UnaryExpression(out e0); while (t.kind == 32 || t.kind == 72 || t.kind == 73) { MulOp(out x, out op); UnaryExpression(out e1); e0 = new BinaryExpr(x, op, e0, e1); } } static void AddOp(out Token! x, out BinaryExpr.Opcode op) { x = Token.NoToken; op=BinaryExpr.Opcode.Add/*(dummy)*/; if (t.kind == 70) { Get(); x = token; op = BinaryExpr.Opcode.Add; } else if (t.kind == 71) { Get(); x = token; op = BinaryExpr.Opcode.Sub; } else Error(119); } static void UnaryExpression(out Expression! e) { Token! x; e = dummyExpr; if (t.kind == 71) { Get(); x = token; UnaryExpression(out e); e = new BinaryExpr(x, BinaryExpr.Opcode.Sub, new LiteralExpr(x, 0), e); } else if (t.kind == 74 || t.kind == 75) { NegOp(); x = token; UnaryExpression(out e); e = new UnaryExpr(x, UnaryExpr.Opcode.Not, e); } else if (StartOf(11)) { SelectExpression(out e); } else if (StartOf(14)) { ConstAtomExpression(out e); } else Error(120); } static void MulOp(out Token! x, out BinaryExpr.Opcode op) { x = Token.NoToken; op = BinaryExpr.Opcode.Add/*(dummy)*/; if (t.kind == 32) { Get(); x = token; op = BinaryExpr.Opcode.Mul; } else if (t.kind == 72) { Get(); x = token; op = BinaryExpr.Opcode.Div; } else if (t.kind == 73) { Get(); x = token; op = BinaryExpr.Opcode.Mod; } else Error(121); } static void NegOp() { if (t.kind == 74) { Get(); } else if (t.kind == 75) { Get(); } else Error(122); } static void ConstAtomExpression(out Expression! e) { Token! x, dtName, id; BigInteger n; List! elements; e = dummyExpr; switch (t.kind) { case 76: { Get(); e = new LiteralExpr(token, false); break; } case 77: { Get(); e = new LiteralExpr(token, true); break; } case 78: { Get(); e = new LiteralExpr(token); break; } case 2: { Nat(out n); e = new LiteralExpr(token, n); break; } case 79: { Get(); x = token; Ident(out dtName); Expect(80); Ident(out id); elements = new List(); if (t.kind == 22) { Get(); if (StartOf(6)) { Expressions(elements); } Expect(23); } e = new DatatypeValue(token, dtName.val, id.val, elements); break; } case 81: { Get(); x = token; Expect(22); Expression(out e); Expect(23); e = new FreshExpr(x, e); break; } case 49: { Get(); x = token; Expression(out e); e = new UnaryExpr(x, UnaryExpr.Opcode.SeqLength, e); Expect(49); break; } case 5: { Get(); x = token; elements = new List(); if (StartOf(6)) { Expressions(elements); } e = new SetDisplayExpr(x, elements); Expect(6); break; } case 82: { Get(); x = token; elements = new List(); if (StartOf(6)) { Expressions(elements); } e = new SeqDisplayExpr(x, elements); Expect(83); break; } default: Error(123); break; } } static void Nat(out BigInteger n) { Expect(2); try { n = BigInteger.Parse(token.val); } catch (System.FormatException) { SemErr("incorrectly formatted number"); n = BigInteger.Zero; } } static void IdentOrFuncExpression(out Expression! e) { Token! id; e = dummyExpr; List! args; Ident(out id); if (t.kind == 22) { Get(); args = new List(); if (StartOf(6)) { Expressions(args); } Expect(23); e = new FunctionCallExpr(id, id.val, new ImplicitThisExpr(id), args); } if (e == dummyExpr) { if (parseVarScope.Find(id.val) != null) { e = new IdentifierExpr(id, id.val); } else { e = new FieldSelectExpr(id, new ImplicitThisExpr(id), id.val); } } } static void ObjectExpression(out Expression! e) { Token! x; e = dummyExpr; if (t.kind == 85) { Get(); e = new ThisExpr(token); } else if (t.kind == 86) { Get(); x = token; Expect(22); Expression(out e); Expect(23); e = new OldExpr(x, e); } else if (t.kind == 22) { Get(); if (StartOf(15)) { QuantifierGuts(out e); } else if (StartOf(6)) { Expression(out e); } else Error(124); Expect(23); } else Error(125); } static void SelectOrCallSuffix(ref Expression! e) { Token! id, x; List! args; Expression e0 = null; Expression e1 = null; Expression! ee; bool anyDots = false; bool func = false; if (t.kind == 80) { Get(); Ident(out id); if (t.kind == 22) { Get(); args = new List(); func = true; if (StartOf(6)) { Expressions(args); } Expect(23); e = new FunctionCallExpr(id, id.val, e, args); } if (!func) { e = new FieldSelectExpr(id, e, id.val); } } else if (t.kind == 82) { Get(); x = token; if (StartOf(6)) { Expression(out ee); e0 = ee; if (t.kind == 39 || t.kind == 84) { if (t.kind == 84) { Get(); anyDots = true; if (StartOf(6)) { Expression(out ee); e1 = ee; } } else { Get(); Expression(out ee); e1 = ee; } } } else if (t.kind == 84) { Get(); Expression(out ee); anyDots = true; e1 = ee; } else Error(126); assert !anyDots ==> e0 != null; if (anyDots) { assert e0 != null || e1 != null; e = new SeqSelectExpr(x, false, e, e0, e1); } else if (e1 == null) { assert e0 != null; e = new SeqSelectExpr(x, true, e, e0, null); } else { assert e0 != null; e = new SeqUpdateExpr(x, e, e0, e1); } Expect(83); } else Error(127); } static void QuantifierGuts(out Expression! q) { Token! x = Token.NoToken; bool univ = false; BoundVar! bv; List bvars = new List(); Token! tok; Expr! e; ExprSeq! es; Attributes attrs = null; Triggers trigs = null; Expression! body; if (t.kind == 87 || t.kind == 88) { Forall(); x = token; univ = true; } else if (t.kind == 89 || t.kind == 90) { Exists(); x = token; } else Error(128); parseVarScope.PushMarker(); IdentTypeOptional(out bv); bvars.Add(bv); parseVarScope.Push(bv.Name, bv.Name); while (t.kind == 12) { Get(); IdentTypeOptional(out bv); bvars.Add(bv); parseVarScope.Push(bv.Name, bv.Name); } while (t.kind == 5) { AttributeOrTrigger(ref attrs, ref trigs); } QSep(); Expression(out body); if (univ) { q = new ForallExpr(x, bvars, body, trigs, attrs); } else { q = new ExistsExpr(x, bvars, body, trigs, attrs); } parseVarScope.PopMarker(); } static void Forall() { if (t.kind == 87) { Get(); } else if (t.kind == 88) { Get(); } else Error(129); } static void Exists() { if (t.kind == 89) { Get(); } else if (t.kind == 90) { Get(); } else Error(130); } static void AttributeOrTrigger(ref Attributes attrs, ref Triggers trigs) { List es = new List(); Expect(5); if (t.kind == 13) { AttributeBody(ref attrs); } else if (StartOf(6)) { es = new List(); Expressions(es); trigs = new Triggers(es, trigs); } else Error(131); Expect(6); } static void QSep() { if (t.kind == 91) { Get(); } else if (t.kind == 92) { Get(); } else Error(132); } static void AttributeBody(ref Attributes attrs) { string aName; List aArgs = new List(); Attributes.Argument! aArg; Expect(13); Expect(1); aName = token.val; if (StartOf(16)) { AttributeArg(out aArg); aArgs.Add(aArg); while (t.kind == 12) { Get(); AttributeArg(out aArg); aArgs.Add(aArg); } } attrs = new Attributes(aName, aArgs, attrs); } static void AttributeArg(out Attributes.Argument! arg) { Expression! e; arg = dummyAttrArg; if (t.kind == 3) { Get(); arg = new Attributes.Argument(token.val.Substring(1, token.val.Length-2)); } else if (StartOf(6)) { Expression(out e); arg = new Attributes.Argument(e); } else Error(133); } public static void Parse() { Errors.SynErr = new ErrorProc(SynErr); t = new Token(); Get(); Dafny(); } [Microsoft.Contracts.Verify(false)] static void SynErr(int n, string filename, int line, int col) { Errors.count++; System.Console.Write("{0}({1},{2}): syntax error: ", filename, line, col); string s; switch (n) { case 0: s = "EOF expected"; break; case 1: s = "ident expected"; break; case 2: s = "digits expected"; break; case 3: s = "string expected"; break; case 4: s = "class expected"; break; case 5: s = "{ expected"; break; case 6: s = "} expected"; break; case 7: s = "ghost expected"; break; case 8: s = "use expected"; break; case 9: s = "datatype expected"; break; case 10: s = "; expected"; break; case 11: s = "var expected"; break; case 12: s = ", expected"; break; case 13: s = ": expected"; break; case 14: s = "< expected"; break; case 15: s = "> expected"; break; case 16: s = "method expected"; break; case 17: s = "returns expected"; break; case 18: s = "modifies expected"; break; case 19: s = "free expected"; break; case 20: s = "requires expected"; break; case 21: s = "ensures expected"; break; case 22: s = "( expected"; break; case 23: s = ") expected"; break; case 24: s = "bool expected"; break; case 25: s = "int expected"; break; case 26: s = "set expected"; break; case 27: s = "seq expected"; break; case 28: s = "object expected"; break; case 29: s = "function expected"; break; case 30: s = "reads expected"; break; case 31: s = "decreases expected"; break; case 32: s = "* expected"; break; case 33: s = "match expected"; break; case 34: s = "case expected"; break; case 35: s = "=> expected"; break; case 36: s = "label expected"; break; case 37: s = "break expected"; break; case 38: s = "return expected"; break; case 39: s = ":= expected"; break; case 40: s = "new expected"; break; case 41: s = "havoc expected"; break; case 42: s = "if expected"; break; case 43: s = "else expected"; break; case 44: s = "while expected"; break; case 45: s = "invariant expected"; break; case 46: s = "call expected"; break; case 47: s = "foreach expected"; break; case 48: s = "in expected"; break; case 49: s = "| expected"; break; case 50: s = "assert expected"; break; case 51: s = "assume expected"; break; case 52: s = "then expected"; break; case 53: s = "<==> expected"; break; case 54: s = "\\u21d4 expected"; break; case 55: s = "==> expected"; break; case 56: s = "\\u21d2 expected"; break; case 57: s = "&& expected"; break; case 58: s = "\\u2227 expected"; break; case 59: s = "|| expected"; break; case 60: s = "\\u2228 expected"; break; case 61: s = "== expected"; break; case 62: s = "<= expected"; break; case 63: s = ">= expected"; break; case 64: s = "!= expected"; break; case 65: s = "!! expected"; break; case 66: s = "!in expected"; break; case 67: s = "\\u2260 expected"; break; case 68: s = "\\u2264 expected"; break; case 69: s = "\\u2265 expected"; break; case 70: s = "+ expected"; break; case 71: s = "- expected"; break; case 72: s = "/ expected"; break; case 73: s = "% expected"; break; case 74: s = "! expected"; break; case 75: s = "\\u00ac expected"; break; case 76: s = "false expected"; break; case 77: s = "true expected"; break; case 78: s = "null expected"; break; case 79: s = "# expected"; break; case 80: s = ". expected"; break; case 81: s = "fresh expected"; break; case 82: s = "[ expected"; break; case 83: s = "] expected"; break; case 84: s = ".. expected"; break; case 85: s = "this expected"; break; case 86: s = "old expected"; break; case 87: s = "forall expected"; break; case 88: s = "\\u2200 expected"; break; case 89: s = "exists expected"; break; case 90: s = "\\u2203 expected"; break; case 91: s = ":: expected"; break; case 92: s = "\\u2022 expected"; break; case 93: s = "??? expected"; break; case 94: s = "invalid ClassMemberDecl"; break; case 95: s = "invalid FunctionDecl"; break; case 96: s = "invalid MethodDecl"; break; case 97: s = "invalid TypeAndToken"; break; case 98: s = "invalid MethodSpec"; break; case 99: s = "invalid MethodSpec"; break; case 100: s = "invalid Expression"; break; case 101: s = "invalid ReferenceType"; break; case 102: s = "invalid FunctionSpec"; break; case 103: s = "invalid FunctionBody"; break; case 104: s = "invalid PossiblyWildExpression"; break; case 105: s = "invalid MatchExpression"; break; case 106: s = "invalid Stmt"; break; case 107: s = "invalid OneStmt"; break; case 108: s = "invalid IfStmt"; break; case 109: s = "invalid ForeachStmt"; break; case 110: s = "invalid AssignRhs"; break; case 111: s = "invalid SelectExpression"; break; case 112: s = "invalid Guard"; break; case 113: s = "invalid CallStmtSubExpr"; break; case 114: s = "invalid EquivOp"; break; case 115: s = "invalid ImpliesOp"; break; case 116: s = "invalid AndOp"; break; case 117: s = "invalid OrOp"; break; case 118: s = "invalid RelOp"; break; case 119: s = "invalid AddOp"; break; case 120: s = "invalid UnaryExpression"; break; case 121: s = "invalid MulOp"; break; case 122: s = "invalid NegOp"; break; case 123: s = "invalid ConstAtomExpression"; break; case 124: s = "invalid ObjectExpression"; break; case 125: s = "invalid ObjectExpression"; break; case 126: s = "invalid SelectOrCallSuffix"; break; case 127: s = "invalid SelectOrCallSuffix"; break; case 128: s = "invalid QuantifierGuts"; break; case 129: s = "invalid Forall"; break; case 130: s = "invalid Exists"; break; case 131: s = "invalid AttributeOrTrigger"; break; case 132: s = "invalid QSep"; break; case 133: s = "invalid AttributeArg"; break; default: s = "error " + n; break; } System.Console.WriteLine(s); } static bool[,]! set = { {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, T,x,x,T, T,x,x,T, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x}, {x,T,x,x, x,T,x,T, T,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,x, x,T,T,x, T,x,T,T, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x}, {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x}, {x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x}, {x,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,x, x,T,T,x, T,x,T,T, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,T,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,T,T, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,x,x}, {x,T,T,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, T,T,T,T, x,T,T,x, x,T,T,x, x,x,x,x, x,x,x} }; [Microsoft.Contracts.Verify(false)] static Parser() {} } // end Parser } // end namespace