Changeset 4301

Show
Ignore:
Timestamp:
11/02/09 06:38:29 (3 weeks ago)
Author:
sukyoungryu
Message:

[spec] Added Appendices.

Location:
trunk/Specification
Files:
71 added
1 removed
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/Specification/appendices/appendices.tex

    r4297 r4301  
    2020 
    2121\appendix 
    22 % \input{\home/appendices/calculi/calculi} 
    23 % % \input{\home/appendices/overloading} 
    24 % % \input{\home/appendices/components} 
    25 % \input{\home/appendices/rendering} 
    26 % % \input{\home/appendices/ascii-to-unicode/ascii-to-unicode} 
    27 \input{\home/appendices/operators/operators} 
     22\input{\home/appendices/calculi/calculi} 
     23\input{\home/appendices/overloading} 
     24\input{\home/appendices/components} 
     25\input{\home/appendices/rendering} 
     26\input{\home/appendices/ascii-to-unicode} 
     27\input{\home/appendices/operators} 
    2828\input{\home/appendices/grammars/grammars} 
    29 % \input{\home/appendices/changes} 
    30 % \ifrelease 
    31 % \else 
    32 % \input{\home/appendices/FAQ} 
    33 % \input{\home/appendices/future} 
    34 % \input{\home/appendices/internal-document/internal-document} 
    35 % \fi 
     29\input{\home/appendices/changes} 
     30\ifrelease 
     31\else 
     32\input{\home/appendices/FAQ} 
     33\input{\home/appendices/future} 
     34\input{\home/appendices/internal-document} 
     35\fi 
  • trunk/Specification/appendices/grammars/appendix-cst.tex

    r4295 r4301  
    1818\chapter{Full Grammar for Fortress Implementors} 
    1919\applabel{cst} 
     20 
     21\note{The chapter is not up to date.} 
     22 
     23In this chapter, we provide a complete definition of the Fortress concrete 
     24syntax.  It includes unimplemented Fortress language features 
     25such as dimensions and units, tests and properties, coercions, and where 
     26clauses.  This syntax has been extracted from the parser-generator source 
     27files of an open source partial Fortress reference 
     28implementation~\cite{FortressInterpreter}, available at: 
     29 
     30\begin{center} 
     31\url{http://projectfortress.sun.com} 
     32\end{center} 
     33 
     34The parser of this reference implementation is generated by Rats!~\cite{Rats}, 
     35which generates ``packrat parsers'' that memoize intermediate results to 
     36ensure linear time performance in the presence of unlimited lookahead and 
     37backtracking.  Rats! includes production naming, module modifications, and 
     38semantic predicates.  Actions that generate 
     39semantic values are omitted for simplicity. See~\cite{Rats} for more 
     40information about the Rats! parser generator. 
     41 
     42\footnotesize 
     43 
     44\section{Components and APIs} 
     45\input{\home/appendices/grammars/rats/Compilation.rats} 
     46 
     47\section{Top-level Declarations} 
     48\input{\home/appendices/grammars/rats/Declaration.rats} 
     49 
     50\section{Trait and Object Declarations} 
     51\input{\home/appendices/grammars/rats/TraitObject.rats} 
     52 
     53\section{Variable Declarations} 
     54\input{\home/appendices/grammars/rats/Variable.rats} 
     55 
     56\section{Function Declarations} 
     57\input{\home/appendices/grammars/rats/Function.rats} 
     58 
     59\section{Dimension, Unit, Type Alias, Test, Property, and External Syntax 
     60  Declarations} 
     61\input{\home/appendices/grammars/rats/OtherDecl.rats} 
     62 
     63\section{Headers without Newlines} 
     64\input{\home/appendices/grammars/rats/NoNewlineHeader.rats} 
     65 
     66\section{Headers Maybe with Newlines} 
     67\input{\home/appendices/grammars/rats/MayNewlineHeader.rats} 
     68 
     69\section{Parameters} 
     70\input{\home/appendices/grammars/rats/Parameter.rats} 
     71 
     72\section{Method Declarations} 
     73\input{\home/appendices/grammars/rats/Method.rats} 
     74 
     75\section{Method Parameters} 
     76\input{\home/appendices/grammars/rats/MethodParam.rats} 
     77 
     78\section{Field Declarations} 
     79\input{\home/appendices/grammars/rats/Field.rats} 
     80 
     81\section{Abstract Field Declarations} 
     82\input{\home/appendices/grammars/rats/AbsField.rats} 
     83 
     84\section{Expressions} 
     85\input{\home/appendices/grammars/rats/Expression.rats} 
     86 
     87\section{Expressions Enclosed by Keywords or Symbols} 
     88\input{\home/appendices/grammars/rats/DelimitedExpr.rats} 
     89 
     90\section{Local Declarations} 
     91\input{\home/appendices/grammars/rats/LocalDecl.rats} 
     92 
     93\section{Literals} 
     94\input{\home/appendices/grammars/rats/Literal.rats} 
     95 
     96\section{Expressions without Newlines} 
     97\input{\home/appendices/grammars/rats/NoNewlineExpr.rats} 
     98 
     99\section{Expressions within Array Expressions} 
     100\input{\home/appendices/grammars/rats/NoSpaceExpr.rats} 
     101 
     102\section{Types} 
     103\input{\home/appendices/grammars/rats/Type.rats} 
     104 
     105\section{Types without Newlines} 
     106\input{\home/appendices/grammars/rats/NoNewlineType.rats} 
     107 
     108\section{Symbols and Operators} 
     109\input{\home/appendices/grammars/rats/Symbol.rats} 
     110 
     111\section{Identifiers} 
     112\input{\home/appendices/grammars/rats/Identifier.rats} 
     113 
     114\section{Spaces and Comments} 
     115\input{\home/appendices/grammars/rats/Spacing.rats} 
     116 
     117\normalsize 
  • trunk/Specification/appendices/grammars/concrete-syntax.tex

    r4295 r4301  
    1818\chapter{Simplified Grammar for Application Programmers and Library Writers} 
    1919\applabel{concrete-syntax} 
     20 
     21\note{The chapter is not up to date.} 
     22 
     23In this chapter, we provide a simplified grammar of the Fortress concrete 
     24syntax as documentation, to enable Fortress programmers to understand it 
     25more easily.  It includes unimplemented Fortress language features 
     26such as dimensions and units, tests and properties, coercions, and where 
     27clauses.  The full Fortress grammar is described in \appref{cst}. 
     28 
     29 
     30The simplified grammar does not describe the details of the uses of 
     31operators, whitespaces, and semicolons. 
     32Instead, they are described as follows according to three 
     33different contexts influencing the whitespace-sensitivity of expressions: 
     34\begin{description} 
     35\item[statement] Expressions 
     36immediately enclosed by an expression block are in a statement-like context. 
     37Multiple expressions can appear on a line if they are separated 
     38(or terminated) by semicolons.  If an expression can legally end 
     39at the end of a line, it does; if it cannot, it does not. 
     40A prefix or infix operator that lacks its last operand 
     41prevents an expression from ending.  For example, 
     42%an = expression + 
     43%     spanning + 
     44%     four + 
     45%     lines 
     46%a  = oneLiner 
     47%four() ; on(); one(); line(); 
     48\begin{Fortress} 
     49\(\VAR{an} = \null\)\pushtabs\=\+\(\VAR{expression} +\)\\ 
     50\(     \VAR{spanning} +\)\\ 
     51\(     \VAR{four} +\)\\ 
     52\(     \VAR{lines}\)\-\\\poptabs 
     53\(a  = \VAR{oneLiner}\)\\ 
     54\(\VAR{four}() ; \VAR{on}(); \VAR{one}(); \VAR{line}();\) 
     55\end{Fortress} 
     56 
     57\item[nested] 
     58An expression or list of expressions 
     59immediately enclosed by parentheses or braces 
     60is nested.  Multiple expressions are separated by commas, 
     61and the end of a line does not end an expression.  Because of this 
     62effect, the meaning of a several lines of code can change if they 
     63are wrapped in parentheses.  Parentheses can also be used to ensure 
     64that a multiline expression is not terminated prematurely without 
     65paying special attention to line endings. 
     66%lhs = rhs 
     67%- aSeparateExpression 
     68% 
     69%postProfit(revenue 
     70%           - expenses) 
     71\begin{Fortress} 
     72\(\VAR{lhs} = \VAR{rhs}\)\\ 
     73\(- \VAR{aSeparateExpression}\)\\[4pt] 
     74\(\VAR{postProfit}(\null\)\pushtabs\=\+\(\VAR{revenue}\)\\ 
     75\(           - \VAR{expenses})\)\-\\\poptabs 
     76\end{Fortress} 
     77 
     78\item[pasted] 
     79Fortress has special syntax for matrix pasting.  Within square 
     80brackets, whitespace-separated expressions are treated (depending 
     81on their type) as either matrix elements or submatrices within a 
     82row.  Because whitespace is the separator, it also ends expressions 
     83where possible.  In addition, newline-or-semicolon-separated 
     84rows are pasted vertically along their columns.  Higher-dimensional 
     85pasting is expressed with repeated semicolons, but repeated newlines 
     86do not have the same effect. 
     87%id2a = [ 1 0 ; 0 1 ] 
     88%id2b = [ 1 0 ; 
     89%         0 1 ] 
     90%id2c = [ 1 0 
     91%         0 1 ] 
     92%cube2 = [ 1 0 ; 0 1 ;; 1 -1 ; 1 1 ] 
     93\begin{Fortress} 
     94\(\VAR{id2a} = [1\;0 ; 0\;1\,]\)\\ 
     95\(\VAR{id2b} = [\null\)\pushtabs\=\+\(1\;0 ;\)\\ 
     96\(         0\;1\,]\)\-\\\poptabs 
     97\(\VAR{id2c} = [\null\)\pushtabs\=\+\(1\;0\)\\ 
     98\(         0\;1\,]\)\-\\\poptabs 
     99\({cube}_{2} = [1\;0 ; 0\;1 ;; 1 -1 ; 1\;1\,]\) 
     100\end{Fortress} 
     101 
     102\end{description} 
     103 
     104 
     105The simplified grammar is written in the extended BNF form 
     106with the following three postfix operators: 
     107\begin{itemize} 
     108\item ?: which means that its argument (the symbol or group of symbols in 
     109  parentheses to the left of the operator) can appear zero or one time 
     110\item $*$: which means that its argument can appear zero or more times 
     111\item $+$: which means that its argument can appear one or more times 
     112\end{itemize} 
     113 
     114\section{Components and APIs} 
     115\begin{tabular}{lll} 
     116\emph{File} &::=& \emph{CompilationUnit}\\ 
     117&$|$& \option{\emph{Imports}} \emph{Exports} \option{\emph{Decls}}\\ 
     118&$|$& \option{\emph{Imports}} \emph{AbsDecls} \\ 
     119&$|$& \emph{Imports} \option{\emph{AbsDecls}}\\ 
     120 
     121\emph{CompilationUnit} &::=& \emph{Component}\\ 
     122&$|$&\emph{Api}\\ 
     123 
     124\emph{Component} &::=& 
     125\option{\KWD{native}} 
     126\KWD{component} \emph{APIName} 
     127\option{\emph{Imports}} \emph{Exports} \option{\emph{Decls}} \KWD{end} 
     128\options{\option{\KWD{component}} \emph{APIName}}\\ 
     129\emph{Api} &::=& 
     130\KWD{api} \emph{APIName} 
     131\option{\emph{Imports}} \option{\emph{AbsDecls}} \KWD{end} 
     132\options{\option{\KWD{api}} \emph{APIName}}\\ 
     133 
     134\emph{Imports} &::=& \emph{Import}$^+$\\ 
     135 
     136\emph{Import} 
     137&::=& \KWD{import} \KWD{api} \emph{AliasedAPINames} \\ 
     138&$|$& \KWD{import} \emph{ImportedNames} \\ 
     139 
     140\emph{ImportedNames} 
     141&::=& \emph{APIName} \EXP{.} \{ \EXP{...} \} 
     142\options{\KWD{except} \emph{SimpleNames}}\\ 
     143&$|$& \emph{APIName} \EXP{.} \{ \emph{AliasedSimpleNameList} 
     144\options{\EXP{,} \EXP{...}} \}\\ 
     145&$|$& \emph{QualifiedName} \options{\KWD{as} \emph{Id}}\\ 
     146 
     147\emph{SimpleNames} &::=& \emph{SimpleName} \\ 
     148&$|$& \{ \emph{SimpleNameList} \}\\ 
     149 
     150\emph{SimpleNameList} &::=& \emph{SimpleName}(\EXP{,} \emph{SimpleName})$^*$ \\ 
     151 
     152\emph{AliasedSimpleName} &::=& \emph{Id} \options{\KWD{as} \emph{Id}}\\ 
     153&$|$& \KWD{opr} \option{\KWD{BIG}} (\emph{Encloser} $|$ \emph{Op}) 
     154 \options{\KWD{as} (\emph{Encloser} $|$ \emph{Op})} \\ 
     155&$|$& \KWD{opr} \option{\KWD{BIG}} \emph{EncloserPair} \options{\KWD{as} \emph{EncloserPair}} \\ 
     156 
     157\emph{AliasedSimpleNameList} 
     158&::=& \emph{AliasedSimpleName}(\EXP{,} \emph{AliasedSimpleName})$^*$ \\ 
     159 
     160\emph{AliasedAPINames} &::=& \emph{AliasedAPIName} \\ 
     161&$|$& \{ \emph{AliasedAPINameList} \}\\ 
     162 
     163\emph{AliasedAPIName} &::=& \emph{APIName} \options{\KWD{as} \emph{Id}}\\ 
     164 
     165\emph{AliasedAPINameList} 
     166&::=& \emph{AliasedAPIName}(\EXP{,} \emph{AliasedAPIName})$^*$ \\ 
     167 
     168\emph{Exports} &::=& \emph{Export}$^+$\\ 
     169 
     170\emph{Export} &::=& \KWD{export} \emph{APINames} \\ 
     171 
     172\emph{APINames} &::=& \emph{APIName} \\ 
     173&$|$& \{ \emph{APINameList} \}\\ 
     174 
     175\emph{APINameList} &::=& \emph{APIName}(\EXP{,} \emph{APIName})$^*$ \\ 
     176\end{tabular} 
     177 
     178 
     179\section{Top-level Declarations} 
     180\begin{tabular}{lll} 
     181\emph{Decls} &::=& \emph{Decl}$^+$\\ 
     182 
     183\emph{Decl} &::=& \emph{TraitDecl}\\ 
     184&$|$& \emph{ObjectDecl}\\ 
     185&$|$& \emph{VarDecl}\\ 
     186&$|$& \emph{FnDecl}\\ 
     187&$|$& \emph{DimUnitDecl}\\ 
     188&$|$& \emph{TypeAlias}\\ 
     189&$|$& \emph{TestDecl}\\ 
     190&$|$& \emph{PropertyDecl}\\ 
     191&$|$& \emph{ExternalSyntax}\\ 
     192 
     193\emph{AbsDecls} &::=& \emph{AbsDecl}$^+$\\ 
     194 
     195\emph{AbsDecl} &::=& \emph{AbsTraitDecl}\\ 
     196&$|$& \emph{AbsObjectDecl}\\ 
     197&$|$& \emph{AbsVarDecl}\\ 
     198&$|$& \emph{AbsFnDecl}\\ 
     199&$|$& \emph{DimUnitDecl}\\ 
     200&$|$& \emph{TypeAlias}\\ 
     201&$|$& \emph{TestDecl}\\ 
     202&$|$& \emph{PropertyDecl}\\ 
     203&$|$& \emph{AbsExternalSyntax} 
     204\end{tabular} 
     205 
     206\section{Trait and Object Declarations} 
     207A \emph{TraitHeaderFront} may have 0 or 1 of each \emph{TraitClause}. 
     208 
     209\begin{tabular}{lll} 
     210\emph{TraitDecl}  &::=& \option{\emph{TraitMods}} 
     211\emph{TraitHeaderFront} \emph{TraitClauses} \option{\emph{GoInATrait}} \KWD{end} 
     212\options{\option{\KWD{trait}} \emph{Id}} \\ 
     213 
     214\emph{TraitHeaderFront} &::=& 
     215\KWD{trait} \emph{Id} \option{\emph{StaticParams}} \option{\emph{ExtendsWhere}} \\ 
     216 
     217\emph{TraitClauses} &::=& \emph{TraitClause}$^*$\\ 
     218 
     219\emph{TraitClause} &::=& \emph{Excludes} \\ 
     220&$|$& \emph{Comprises} \\ 
     221&$|$& \emph{Where} \\ 
     222 
     223\emph{GoInATrait} 
     224&::=& \option{\emph{Coercions}} 
     225\emph{GoFrontInATrait} \option{\emph{GoBackInATrait}}\\ 
     226&$|$& \option{\emph{Coercions}} \emph{GoBackInATrait} \\ 
     227&$|$& \emph{Coercions}\\ 
     228 
     229\emph{Coercions} &::=& \emph{Coercion}$^+$\\ 
     230 
     231\emph{GoFrontInATrait} &::=& \emph{GoesFrontInATrait}$^+$\\ 
     232 
     233\emph{GoesFrontInATrait} 
     234&::=& \emph{AbsFldDecl} \\ 
     235&$|$& \emph{GetterSetterDecl} \\ 
     236&$|$& \emph{PropertyDecl} \\ 
     237 
     238\emph{GoBackInATrait} &::=& \emph{GoesBackInATrait}$^+$\\ 
     239 
     240\emph{GoesBackInATrait} 
     241&::=& \emph{MdDecl} \\ 
     242&$|$& \emph{PropertyDecl} \\ 
     243 
     244\emph{ObjectDecl}  &::=& \option{\emph{ObjectMods}} 
     245\emph{ObjectHeader} \option{\emph{GoInAnObject}} \KWD{end} 
     246\options{\option{\KWD{object}} \emph{Id}}\\ 
     247 
     248\emph{ObjectHeader} &::=& \KWD{object} \emph{Id} 
     249\option{\emph{StaticParams}} \option{\emph{ObjectValParam}} 
     250\option{\emph{ExtendsWhere}} \emph{FnClauses} \\ 
     251 
     252\end{tabular} 
     253 
     254\begin{tabular}{lll} 
     255\emph{ObjectValParam} &::=& \texttt( \option{\emph{ObjectParams}} \texttt) \\ 
     256 
     257\emph{ObjectParams} 
     258&::=& (\emph{ObjectParam} \EXP{,})$^*$ \options{\emph{ObjectVarargs} \EXP{,}} 
     259       \emph{ObjectKeyword}(\EXP{,}\emph{ObjectKeyword})$^*$\\ 
     260&$|$& (\emph{ObjectParam} \EXP{,})$^*$ \emph{ObjectVarargs}\\ 
     261&$|$& \emph{ObjectParam} (\EXP{,} \emph{ObjectParam})$^*$\\ 
     262 
     263\emph{ObjectVarargs} &::=& \KWD{transient} \emph{Varargs}\\ 
     264 
     265\emph{ObjectKeyword} &::=& \emph{ObjectParam}\EXP{=}\emph{Expr}\\ 
     266 
     267\emph{ObjectParam} &::=& \option{\emph{ParamFldMods}} \emph{Param} \\ 
     268&$|$& \KWD{var} \KWD{transient} \emph{ParamWType} \\ 
     269&$|$& \option{\KWD{transient}} \KWD{var} \emph{ParamWType} \\ 
     270&$|$& \KWD{transient} \emph{Param} \\ 
     271 
     272\emph{ParamWType} &::=& \emph{BindId} \option{\emph{IsType}} \\ 
     273 
     274\emph{GoInAnObject} 
     275&::=& \option{\emph{Coercions}} 
     276\emph{GoFrontInAnObject} \option{\emph{GoBackInAnObject}}\\ 
     277&$|$& \option{\emph{Coercions}} \emph{GoBackInAnObject} \\ 
     278&$|$& \emph{Coercions}\\ 
     279 
     280\emph{GoFrontInAnObject} &::=& \emph{GoesFrontInAnObject}$^+$\\ 
     281 
     282\emph{GoesFrontInAnObject} 
     283&::=& \emph{FldDecl} \\ 
     284&$|$& \emph{GetterSetterDef} \\ 
     285&$|$& \emph{PropertyDecl} \\ 
     286 
     287\emph{GoBackInAnObject} &::=& \emph{GoesBackInAnObject}$^+$\\ 
     288 
     289\emph{GoesBackInAnObject} 
     290&::=& \emph{MdDef} \\ 
     291&$|$& \emph{PropertyDecl} \\ 
     292 
     293\emph{AbsTraitDecl}  &::=& \option{\emph{AbsTraitMods}} 
     294\emph{TraitHeaderFront} \emph{AbsTraitClauses} 
     295\option{\emph{AbsGoInATrait}} \KWD{end} 
     296\options{\option{\KWD{trait}} \emph{Id}} \\ 
     297 
     298\emph{AbsTraitClauses} &::=& \emph{AbsTraitClause}$^*$\\ 
     299 
     300\emph{AbsTraitClause} &::=& \emph{Excludes} \\ 
     301&$|$& \emph{AbsComprises} \\ 
     302&$|$& \emph{Where} \\ 
     303 
     304\emph{AbsGoInATrait} 
     305&::=& \option{\emph{AbsCoercions}} 
     306\emph{AbsGoFrontInATrait} \option{\emph{AbsGoBackInATrait}}\\ 
     307&$|$& \option{\emph{AbsCoercions}} \emph{AbsGoBackInATrait} \\ 
     308&$|$& \emph{AbsCoercions}\\ 
     309 
     310\emph{AbsCoercions} &::=& \emph{AbsCoercion}$^+$\\ 
     311 
     312\emph{AbsGoFrontInATrait} &::=& \emph{AbsGoesFrontInATrait}$^+$\\ 
     313 
     314\emph{AbsGoesFrontInATrait} 
     315&::=& \emph{ApiFldDecl} \\ 
     316&$|$& \emph{AbsGetterSetterDecl} \\ 
     317&$|$& \emph{PropertyDecl} \\ 
     318 
     319\emph{AbsGoBackInATrait} &::=& \emph{AbsGoesBackInATrait}$^+$\\ 
     320 
     321\emph{AbsGoesBackInATrait} 
     322&::=& \emph{AbsMdDecl} \\ 
     323&$|$& \emph{PropertyDecl} \\ 
     324 
     325\emph{AbsObjectDecl} &::=& \option{\emph{AbsObjectMods}} 
     326 \emph{ObjectHeader} \option{\emph{AbsGoInAnObject}} \KWD{end} 
     327\options{\option{\KWD{object}} \emph{Id}}\\ 
     328 
     329\emph{AbsGoInAnObject} 
     330&::=& \option{\emph{AbsCoercions}} 
     331\emph{AbsGoFrontInAnObject} \option{\emph{AbsGoBackInAnObject}}\\ 
     332&$|$& \option{\emph{AbsCoercions}} \emph{AbsGoBackInAnObject} \\ 
     333&$|$& \emph{AbsCoercions}\\ 
     334 
     335\emph{AbsGoFrontInAnObject} &::=& \emph{AbsGoesFrontInAnObject}$^+$\\ 
     336 
     337\emph{AbsGoesFrontInAnObject} 
     338&::=& \emph{ApiFldDecl} \\ 
     339&$|$& \emph{AbsGetterSetterDecl} \\ 
     340&$|$& \emph{PropertyDecl} \\ 
     341 
     342\emph{AbsGoBackInAnObject} &::=& \emph{AbsGoesBackInAnObject}$^+$\\ 
     343 
     344\emph{AbsGoesBackInAnObject} 
     345&::=& \emph{AbsMdDecl} \\ 
     346&$|$& \emph{PropertyDecl} \\ 
     347 
     348\end{tabular} 
     349 
     350\section{Variable Declarations} 
     351\begin{tabular}{lll} 
     352\emph{VarDecl} 
     353&::=& \option{\emph{VarMods}} \emph{VarWTypes} \emph{InitVal} \\ 
     354&$|$& \option{\emph{VarImmutableMods}} \emph{BindIdOrBindIdTuple} \EXP{=} \emph{Expr}\\ 
     355&$|$& \option{\emph{VarMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{Type}\EXP{...} 
     356\emph{InitVal} \\ 
     357&$|$& \option{\emph{VarMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{TupleType} 
     358\emph{InitVal} \\ 
     359 
     360\emph{VarMods} &::=& \emph{VarMod}$^+$\\ 
     361 
     362\emph{VarImmutableMods} &::=& \emph{VarImmutableMod}$^+$\\ 
     363 
     364\emph{VarMod} &::=& \emph{AbsVarMod} $|$ \KWD{private}\\ 
     365 
     366\emph{VarImmutableMod} &::=& \emph{AbsVarImmutableMod} $|$ \KWD{private}\\ 
     367 
     368\emph{VarWTypes} &::=& \emph{VarWType} \\ 
     369&$|$& \texttt{(} \emph{VarWType}(\EXP{,} \emph{VarWType})$^+$ \texttt{)}\\ 
     370 
     371\emph{VarWType} &::=& \emph{BindId} \emph{IsType}\\ 
     372 
     373\emph{InitVal} &::=& (\EXP{=}$|$\EXP{\ASSIGN}) \emph{Expr} \\ 
     374 
     375\emph{AbsVarDecl} &::=& \option{\emph{AbsVarMods}} \emph{VarWTypes}\\ 
     376&$|$& \option{\emph{AbsVarMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{Type}\EXP{...}\\ 
     377&$|$& \option{\emph{AbsVarMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{TupleType}\\ 
     378 
     379\emph{AbsVarMods} &::=& \emph{AbsVarMod}$^+$\\ 
     380 
     381\emph{AbsVarMod} &::=& \KWD{var} $|$ \KWD{test}\\ 
     382 
     383\emph{AbsVarImmutableMod} &::=& \KWD{test}\\ 
     384\end{tabular} 
     385 
     386\section{Function Declarations} 
     387\begin{tabular}{lll} 
     388\emph{FnDecl} 
     389&::=& \option{\emph{FnMods}} \emph{FnHeaderFront} \emph{FnHeaderClause} 
     390\EXP{=} \emph{Expr} \\ 
     391&$|$& \option{\emph{FnMods}} \emph{AbsFnHeaderFront} \emph{FnHeaderClause}\\ 
     392&$|$& \emph{FnSig} \\ 
     393 
     394\emph{FnSig} &::=& \emph{SimpleName} \EXP{\mathrel{\mathtt{:}}} \emph{Type}\\ 
     395 
     396\emph{AbsFnDecl} &::=& \option{\emph{AbsFnMods}} \emph{AbsFnHeaderFront} 
     397\emph{FnHeaderClause}\\ 
     398&$|$& \emph{FnSig} \\ 
     399 
     400\emph{FnHeaderFront} 
     401&::=& \emph{NamedFnHeaderFront}\\ 
     402&$|$& \emph{OpHeaderFront} \\ 
     403 
     404\emph{AbsFnHeaderFront} 
     405&::=& \emph{AbsNamedFnHeaderFront}\\ 
     406&$|$& \emph{AbsOpHeaderFront} \\ 
     407 
     408\emph{NamedFnHeaderFront} 
     409&::=& \emph{Id} \option{\emph{StaticParams}} \emph{ValParam} \\ 
     410 
     411\emph{AbsNamedFnHeaderFront} 
     412&::=& \emph{Id} \option{\emph{StaticParams}} \emph{AbsValParam} \\ 
     413\end{tabular} 
     414 
     415\section{Dimension, Unit, Type Alias, Test, Property, and External Syntax 
     416  Declarations} 
     417\begin{tabular}{lll} 
     418\emph{DimUnitDecl} 
     419&::=& 
     420\KWD{dim} \emph{Id} \options{\EXP{=} \emph{Type}} 
     421(\KWD{unit} $|$ \KWD{SI\_unit}) \emph{Id}$^+$ 
     422\options{\EXP{=} \emph{Expr}}\\ 
     423&$|$& 
     424\KWD{dim} \emph{Id} 
     425\options{\EXP{=} \emph{Type}} \options{\KWD{default} \emph{Id}}\\ 
     426&$|$& 
     427(\KWD{unit} $|$ \KWD{SI\_unit}) 
     428\emph{Id}$^+$ \options{\EXP{\mathrel{\mathtt{:}}} \emph{Type}} 
     429 \options{\EXP{=} \emph{Expr}}\\ 
     430 
     431\emph{TypeAlias} &::=& \KWD{type} \emph{Id} \option{\emph{StaticParams}} 
     432\EXP{=} \emph{Type} \\ 
     433 
     434\emph{TestDecl} &::=& \KWD{test} \emph{Id} \texttt[\emph{GeneratorClauseList}\texttt] 
     435\EXP{=} \emph{Expr} \\ 
     436 
     437\emph{PropertyDecl} &::=& \KWD{property} \options{\emph{Id} \EXP{=}} 
     438\options{$\forall$ \emph{ValParam}} \emph{Expr} \\ 
     439 
     440\emph{ExternalSyntax} &::=& 
     441\KWD{syntax} \emph{OpenExpander} \emph{Id} \emph{CloseExpander} 
     442 \EXP{=} \emph{Expr} \\ 
     443 
     444\emph{OpenExpander} &::=& \emph{Id}\\ 
     445&$|$& \emph{LeftEncloser} \\ 
     446&$|$& \emph{Encloser} \\ 
     447 
     448\emph{CloseExpander} &::=& \emph{Id} \\ 
     449&$|$& \emph{RightEncloser}\\ 
     450&$|$& \emph{Encloser} \\ 
     451&$|$& \KWD{end} \\ 
     452 
     453\emph{AbsExternalSyntax} &::=& 
     454\KWD{syntax} \emph{OpenExpander} \emph{Id} \emph{CloseExpander}\\ 
     455 
     456\end{tabular} 
     457 
     458\section{Headers} 
     459Each modifier should not appear multiple times in a declaration. 
     460 
     461\begin{tabular}{lll} 
     462\emph{IsType} &::=& \EXP{\mathrel{\mathtt{:}}} \emph{Type}\\ 
     463 
     464\emph{ExtendsWhere} &::=& \KWD{extends} \emph{TraitTypeWheres} \\ 
     465 
     466\emph{TraitTypeWheres} &::=& \emph{TraitTypeWhere} \\ 
     467&$|$& \{ \emph{TraitTypeWhereList} \} \\ 
     468 
     469\emph{TraitTypeWhereList} &::=& \emph{TraitTypeWhere}(\EXP{,} \emph{TraitTypeWhere})$^*$ \\ 
     470 
     471\emph{TraitTypeWhere} &::=& \emph{TraitType} \option{\emph{Where}}\\ 
     472 
     473\emph{Extends} &::=& \KWD{extends} \emph{TraitTypes} \\ 
     474\emph{Excludes} &::=& \KWD{excludes} \emph{TraitTypes} \\ 
     475\emph{Comprises} &::=& \KWD{comprises} \emph{TraitTypes} \\ 
     476\emph{AbsComprises} &::=& \KWD{comprises} \emph{ComprisingTypes} \\ 
     477 
     478\emph{TraitTypes} &::=& \emph{TraitType} \\ 
     479&$|$& \{ \emph{TraitTypeList} \} \\ 
     480\emph{TraitTypeList} &::=& \emph{TraitType}(\EXP{,} \emph{TraitType})$^*$ \\ 
     481 
     482\emph{ComprisingTypes} 
     483&::=& \emph{TraitType} \\ 
     484&$|$& \texttt{\{} \emph{ComprisingTypeList} \texttt{\}} \\ 
     485 
     486\emph{ComprisingTypeList} 
     487&::=& \EXP{\ldots} \\ 
     488&$|$& \emph{TraitType}(\EXP{,} \emph{TraitType})$^*$ \options{\EXP{,} \ldots}\\ 
     489 
     490\emph{Where} 
     491&::=& \KWD{where} \bTPl\ \emph{WhereBindingList} \bTPr\ 
     492\options{\{ \emph{WhereConstraintList} \}}\\ 
     493&$|$& \KWD{where} \{ \emph{WhereConstraintList} \}\\ 
     494 
     495\emph{WhereBindingList} &::=& \emph{WhereBinding}(\EXP{,} 
     496\emph{WhereBinding})$^*$ \\ 
     497 
     498\emph{WhereBinding} &::=& \emph{Id} \option{\emph{Extends}}\\ 
     499&$|$& \KWD{nat} \emph{Id}\\ 
     500&$|$& \KWD{int} \emph{Id}\\ 
     501&$|$& \KWD{bool} \emph{Id}\\ 
     502&$|$& \KWD{unit} \emph{Id}\\ 
     503 
     504\emph{WhereConstraintList} &::=& \emph{WhereConstraint}(\EXP{,} 
     505\emph{WhereConstraint})$^*$ \\ 
     506 
     507\emph{WhereConstraint} 
     508&::=& \emph{Id} \emph{Extends}\\ 
     509&$|$& \emph{TypeAlias} \\ 
     510&$|$& \emph{Type} \KWD{coerces} \emph{Type}\\ 
     511&$|$& \emph{Type} \KWD{widens} \emph{Type}\\ 
     512&$|$& \emph{UnitConstraint} \\ 
     513&$|$& \emph{QualifiedName} \EXP{=} \emph{QualifiedName}\\ 
     514&$|$& \emph{IntConstraint} \\ 
     515&$|$& \emph{BoolConstraint} \\ 
     516 
     517\emph{UnitConstraint} 
     518&::=& \TYP{dimensionless} \EXP{=} \emph{Id}\\ 
     519&$|$& \emph{Id} \EXP{=} \TYP{dimensionless} \\ 
     520 
     521\emph{IntConstraint} 
     522&::=& \emph{IntExpr} $\le$ \emph{IntExpr} \\ 
     523&$|$& \emph{IntExpr} $<$ \emph{IntExpr} \\ 
     524&$|$& \emph{IntExpr} $\ge$ \emph{IntExpr} \\ 
     525&$|$& \emph{IntExpr} $>$ \emph{IntExpr} \\ 
     526&$|$& \emph{IntExpr} \EXP{=} \emph{IntExpr} \\ 
     527 
     528\emph{IntVal} 
     529&::=& \emph{IntLiteralExpr}\\ 
     530&$|$& \emph{QualifiedName}\\ 
     531 
     532\end{tabular} 
     533 
     534\begin{tabular}{lll} 
     535\emph{IntExpr} 
     536&::=& \emph{IntVal}\\ 
     537&$|$& \emph{IntExpr} \EXP{+} \emph{IntExpr}\\ 
     538&$|$& \emph{IntExpr} \EXP{-} \emph{IntExpr}\\ 
     539&$|$& \emph{IntExpr} $\csdot$ \emph{IntExpr}\\ 
     540&$|$& \emph{IntExpr} \emph{IntExpr}\\ 
     541&$|$& \emph{IntExpr} \texttt{\^} \emph{IntVal}\\ 
     542&$|$& \texttt{(}\emph{IntExpr}\texttt{)} \\ 
     543 
     544\emph{BoolConstraint} 
     545&::=& \OPR{NOT} \emph{BoolExpr} \\ 
     546&$|$& \emph{BoolExpr} \OPR{OR} \emph{BoolExpr} \\ 
     547&$|$& \emph{BoolExpr} \OPR{AND} \emph{BoolExpr} \\ 
     548&$|$& \emph{BoolExpr} \OPR{IMPLIES} \emph{BoolExpr} \\ 
     549&$|$& \emph{BoolExpr} \EXP{=} \emph{BoolExpr} \\ 
     550 
     551\emph{BoolVal} 
     552&::=& \VAR{true}\\ 
     553&$|$& \VAR{false}\\ 
     554&$|$& \emph{QualifiedName}\\ 
     555 
     556\emph{BoolExpr} 
     557&::=& \emph{BoolVal}\\ 
     558&$|$& \emph{BoolConstraint}\\ 
     559&$|$& \texttt{(}\emph{BoolExpr}\texttt{)} \\ 
     560 
     561\emph{UnitExpr} 
     562&::=& \VAR{dimensionless}\\ 
     563&$|$& \emph{QualifiedName}\\ 
     564&$|$& \emph{UnitExpr} $\csdot$ \emph{UnitExpr}\\ 
     565&$|$& \emph{UnitExpr} \emph{UnitExpr}\\ 
     566&$|$& \emph{UnitExpr} \EXP{/} \emph{UnitExpr}\\ 
     567&$|$& \emph{UnitExpr} \TYP{per} \emph{UnitExpr}\\ 
     568&$|$& \emph{UnitExpr} \texttt{\^} \emph{UnitExpr}\\ 
     569&$|$& \texttt{(}\emph{UnitExpr}\texttt{)} \\ 
     570 
     571\emph{FnHeaderClause} &::=& \option{\emph{IsType}} \emph{FnClauses} \\ 
     572 
     573\emph{FnClauses} &::=& \option{\emph{Throws}} \option{\emph{Where}} \emph{Contract} \\ 
     574 
     575\emph{Throws} &::=& \KWD{throws} \emph{MayTraitTypes}\\ 
     576 
     577\emph{MayTraitTypes} &::=& \texttt{\{\}} \\ 
     578&$|$& \emph{TraitTypes} \\ 
     579 
     580\emph{Contract} &::=& \option{\emph{Requires}} \option{\emph{Ensures}} \option{\emph{Invariant}}\\ 
     581 
     582\emph{Requires} &::=& 
     583\KWD{requires} \{ \option{\emph{ExprList}} \} \\ 
     584 
     585\emph{Ensures}  &::=& 
     586\KWD{ensures} \{ \option{\emph{EnsuresClauseList}} \} \\ 
     587 
     588\emph{EnsuresClauseList} &::=& 
     589\emph{EnsuresClause}(\EXP{,} \emph{EnsuresClause})$^*$ \\ 
     590 
     591\emph{EnsuresClause} &::=& \emph{Expr} \options{\KWD{provided} \emph{Expr}} \\ 
     592 
     593\emph{Invariant}&::=& 
     594\KWD{invariant} \{ \option{\emph{ExprList}} \} \\ 
     595 
     596\emph{TraitMods} &::=& \emph{TraitMod}$^+$\\ 
     597 
     598\emph{TraitMod} &::=& \emph{AbsTraitMod} $|$ \KWD{private}\\ 
     599 
     600\emph{AbsTraitMods} &::=& \emph{AbsTraitMod}$^+$\\ 
     601 
     602\emph{AbsTraitMod} &::=& \KWD{value} $|$ \KWD{test}\\ 
     603 
     604\emph{ObjectMods} &::=& \emph{TraitMods}\\ 
     605 
     606\emph{AbsObjectMods} &::=& \emph{AbsTraitMods}\\ 
     607 
     608\emph{MdMods} &::=& \emph{MdMod}$^+$\\ 
     609 
     610\emph{MdMod} &::=& \emph{FnMod} $|$ \KWD{override}\\ 
     611 
     612\emph{AbsMdMods} &::=& \emph{AbsMdMod}$^+$\\ 
     613 
     614\emph{AbsMdMod} &::=& \emph{AbsFnMod} $|$ \KWD{override}\\ 
     615 
     616\emph{FnMods} &::=& \emph{FnMod}$^+$\\ 
     617 
     618\emph{FnMod} &::=& \emph{AbsFnMod} $|$ \KWD{private}\\ 
     619 
     620\emph{AbsFnMods} &::=& \emph{AbsFnMod}$^+$\\ 
     621 
     622\emph{AbsFnMod} &::=& \emph{LocalFnMod} $|$ \KWD{test}\\ 
     623 
     624\emph{LocalFnMods} &::=& \emph{LocalFnMod}$^+$\\ 
     625 
     626\emph{LocalFnMod} &::=& \KWD{atomic} $|$ \KWD{io}\\ 
     627 
     628\end{tabular} 
     629 
     630\begin{tabular}{lll} 
     631\emph{ParamFldMods} &::=& \emph{ParamFldMod}$^+$\\ 
     632 
     633\emph{ParamFldMod} &::=& 
     634\KWD{hidden} $|$ \KWD{settable} $|$ \KWD{wrapped}\\ 
     635 
     636\emph{FldMods} &::=& \emph{FldMod}$^+$\\ 
     637 
     638\emph{FldImmutableMods} &::=& \emph{FldImmutableMod}$^+$\\ 
     639 
     640\emph{FldMod} &::=& \KWD{var} $|$ \emph{AbsFldMod}\\ 
     641 
     642\emph{FldImmutableMod} &::=& \emph{AbsFldMod}\\ 
     643 
     644\emph{AbsFldMods} &::=& \emph{AbsFldMod}$^+$\\ 
     645 
     646\emph{AbsFldMod} &::=& \emph{ApiFldMod} $|$ \KWD{wrapped} $|$ \KWD{private}\\ 
     647 
     648\emph{ApiFldMods} &::=& \emph{ApiFldMod}$^+$\\ 
     649 
     650\emph{ApiFldMod} &::=& \KWD{hidden} $|$ \KWD{settable} $|$ \KWD{test}\\ 
     651 
     652\emph{StaticParams} &::=& \bTPl \emph{StaticParamList}\bTPr\\ 
     653 
     654\emph{StaticParamList} &::=& \emph{StaticParam}(\EXP{,} \emph{StaticParam})$^*$\\ 
     655 
     656\emph{StaticParam} 
     657&::=& \emph{Id} \option{\emph{Extends}} \options{\KWD{absorbs} \KWD{unit}} \\ 
     658&$|$& \KWD{nat} \emph{Id} \\ 
     659&$|$& \KWD{int} \emph{Id} \\ 
     660&$|$& \KWD{bool} \emph{Id} \\ 
     661&$|$& \KWD{dim} \emph{Id} \\ 
     662&$|$& \KWD{unit} \emph{Id} \options{\EXP{\mathrel{\mathtt{:}}} \emph{Type}} 
     663 \options{\KWD{absorbs} \KWD{unit}}\\ 
     664&$|$& \KWD{opr} \emph{Op} \\ 
     665 
     666\emph{StaticArgs}    &::=& \bTPl \emph{StaticArgList} \bTPr \\ 
     667 
     668\emph{StaticArgList} &::=& \emph{StaticArg}(\EXP{,} \emph{StaticArg})$^*$ \\ 
     669 
     670\emph{StaticArg} &::=& 
     671\emph{Op} \\ 
     672&$|$& \TYP{Unity} \\ 
     673&$|$& \TYP{dimensionless}\\ 
     674&$|$& \EXP{1}\EXP{/}\emph{Type}\\ 
     675&$|$& \emph{DimPrefixOp} \emph{Type}\\ 
     676&$|$& \emph{IntExpr}\\ 
     677&$|$& \emph{BoolExpr}\\ 
     678&$|$& \emph{Type}\\ 
     679&$|$& \emph{UnitExpr}\\ 
     680 
     681\end{tabular} 
     682 
     683\section{Parameters} 
     684\begin{tabular}{lll} 
     685\emph{ValParam} &::=& \emph{BindId}\\ 
     686&$|$& \texttt(\option{\emph{Params}}\texttt)\\ 
     687 
     688\emph{AbsValParam} &::=& \texttt(\option{\emph{AbsParams}}\texttt)\\ 
     689&$|$& \emph{Type}\\ 
     690 
     691\emph{Params} 
     692&::=& (\emph{Param}\EXP{,})$^*$ \options{\emph{Varargs}\EXP{,}} \emph{Keyword}(\EXP{,}\emph{Keyword})$^*$\\ 
     693&$|$& (\emph{Param}\EXP{,})$^*$  \emph{Varargs}\\ 
     694&$|$& \emph{Param}(\EXP{,} \emph{Param})$^*$\\ 
     695 
     696\emph{AbsParams} 
     697&::=& (\emph{AbsParam}\EXP{,})$^*$ \options{\emph{Varargs}\EXP{,}} \emph{Keyword}(\EXP{,}\emph{Keyword})$^*$\\ 
     698&$|$& (\emph{AbsParam}\EXP{,})$^*$  \emph{Varargs}\\ 
     699&$|$& \emph{AbsParam}(\EXP{,} \emph{AbsParam})$^*$\\ 
     700 
     701\emph{VarargsParam} &::=& \emph{BindId}\EXP{\COLONOP}\emph{Type}\EXP{...} \\ 
     702 
     703\emph{Varargs} &::=& \emph{VarargsParam}\\ 
     704 
     705\emph{Keyword} &::=& \emph{Param}\EXP{=}\emph{Expr} \\ 
     706 
     707\emph{PlainParam} &::=& \emph{BindId} \option{\emph{IsType}} \\ 
     708 
     709\emph{Param} &::=& \emph{PlainParam}\\ 
     710 
     711\emph{AbsPlainParam} &::=& \emph{BindId} \emph{IsType} \\ 
     712&$|$& \emph{Type} \\ 
     713 
     714\emph{AbsParam} &::=& \emph{AbsPlainParam}\\ 
     715 
     716\emph{OpHeaderFront} 
     717&::=& \KWD{opr} \option{\KWD{BIG}} 
     718(\{\EXP{\mapsto} $|$ \emph{LeftEncloser} $|$ \emph{Encloser}) \option{\emph{StaticParams}} 
     719\option{\emph{Params}} (\emph{RightEncloser} $|$ \emph{Encloser}) \\ 
     720&$|$& \KWD{opr} \emph{ValParam} 
     721(\emph{Op} $|$ \emph{ExponentOp}) \option{\emph{StaticParams}} \\ 
     722&$|$& \KWD{opr} \option{\KWD{BIG}} 
     723(\emph{Op} $|$ \texttt{\^} $|$ \emph{Encloser} $|$ $\sum$ $|$ $\prod$) 
     724 \option{\emph{StaticParams}} \emph{ValParam} \\ 
     725 
     726\emph{AbsOpHeaderFront} 
     727&::=& \KWD{opr} \option{\KWD{BIG}} 
     728(\{\EXP{\mapsto} $|$ \emph{LeftEncloser} $|$ \emph{Encloser}) \option{\emph{StaticParams}} 
     729\option{\emph{AbsParams}} (\emph{RightEncloser} $|$ \emph{Encloser}) \\ 
     730&$|$& \KWD{opr} \emph{AbsValParam} 
     731(\emph{Op} $|$ \emph{ExponentOp}) \option{\emph{StaticParams}} \\ 
     732&$|$& \KWD{opr} \option{\KWD{BIG}} 
     733(\emph{Op} $|$ \texttt{\^} $|$ \emph{Encloser} $|$ $\sum$ $|$ $\prod$) 
     734 \option{\emph{StaticParams}} \emph{AbsValParam} \\ 
     735\end{tabular} 
     736 
     737\section{Method Declarations} 
     738\begin{tabular}{lll} 
     739\emph{MdDecl} &::=& \emph{MdDef} \\ 
     740&$|$& \option{\KWD{abstract}} \option{\emph{MdMods}} \emph{AbsMdHeaderFront} 
     741\emph{FnHeaderClause} \\ 
     742 
     743\emph{MdDef}  &::=& \option{\emph{MdMods}} \emph{MdHeaderFront} \emph{FnHeaderClause} 
     744\EXP{=} \emph{Expr} \\ 
     745 
     746\emph{AbsMdDecl} &::=& 
     747\option{\KWD{abstract}} \option{\emph{AbsMdMods}} \emph{AbsMdHeaderFront} 
     748\emph{FnHeaderClause} \\ 
     749 
     750\emph{MdHeaderFront}  &::=& \emph{NamedMdHeaderFront}\\ 
     751&$|$& \emph{OpMdHeaderFront} \\ 
     752 
     753\emph{AbsMdHeaderFront}  &::=& \emph{AbsNamedMdHeaderFront}\\ 
     754&$|$& \emph{AbsOpMdHeaderFront} \\ 
     755 
     756\emph{NamedMdHeaderFront} &::=& 
     757\emph{Id} \option{\emph{StaticParams}} \emph{MdValParam} \\ 
     758 
     759\emph{AbsNamedMdHeaderFront} &::=& 
     760\emph{Id} \option{\emph{StaticParams}} \emph{AbsMdValParam} \\ 
     761 
     762\emph{GetterSetterDecl} &::=& \emph{GetterSetterDef} \\ 
     763&$|$& \option{\KWD{abstract}} \option{\emph{FnMods}} 
     764 \emph{GetterSetterMod} \emph{AbsMdHeaderFront} \emph{FnHeaderClause} \\ 
     765 
     766\emph{GetterSetterDef}  &::=& \option{\emph{FnMods}} \emph{GetterSetterMod} 
     767\emph{MdHeaderFront} \emph{FnHeaderClause} 
     768\EXP{=} \emph{Expr} \\ 
     769 
     770\emph{GetterSetterMod} &::=& \KWD{getter} $|$ \KWD{setter}\\ 
     771 
     772\emph{AbsGetterSetterDecl} &::=& \option{\KWD{abstract}} \option{\emph{AbsFnMods}} 
     773 \emph{GetterSetterMod} \emph{AbsMdHeaderFront} \emph{FnHeaderClause} \\ 
     774 
     775\emph{Coercion} &::=& 
     776\KWD{coerce}\option{\emph{StaticParams}}\texttt(\emph{BindId} \emph{IsType}\texttt)\emph{CoercionClauses} \option{\KWD{widens}} \EXP{=} \emph{Expr}\\ 
     777 
     778\emph{AbsCoercion} &::=& 
     779\KWD{coerce}\option{\emph{StaticParams}}\texttt(\emph{BindId} \emph{IsType}\texttt)\emph{CoercionClauses} \option{\KWD{widens}}\\ 
     780 
     781\emph{CoercionClauses} &::=& 
     782\option{\emph{CoercionWhere}} 
     783\option{\emph{Ensures}} \option{\emph{Invariant}}\\ 
     784 
     785\emph{CoercionWhere} 
     786&::=& \KWD{where} \bTPl\ \emph{WhereBindingList} \bTPr\ 
     787\options{\{ \emph{CoercionWhereConstraintList} \}}\\ 
     788&$|$& \KWD{where} \{ \emph{CoercionWhereConstraintList} \}\\ 
     789 
     790\emph{CoercionWhereConstraintList} &::=& \emph{CoercionWhereConstraint}(\EXP{,} 
     791\emph{CoercionWhereConstraint})$^*$ \\ 
     792 
     793\emph{CoercionWhereConstraint} &::=& \emph{WhereConstraint}\\ 
     794&$|$& \emph{Type} \KWD{widens} \KWD{or} \KWD{coerces} \emph{Type}\\ 
     795 
     796\end{tabular} 
     797 
     798\section{Method Parameters} 
     799\begin{tabular}{lll} 
     800\emph{MdValParam} &::=& \texttt( \option{\emph{MdParams}} \texttt) \\ 
     801 
     802\emph{AbsMdValParam} &::=& \texttt( \option{\emph{AbsMdParams}} \texttt) \\ 
     803 
     804\emph{MdParams} 
     805&::=& (\emph{MdParam}\EXP{,})$^*$ \options{\emph{Varargs}\EXP{,}} \emph{MdKeyword}(\EXP{,}\emph{MdKeyword})$^*$\\ 
     806&$|$& (\emph{MdParam}\EXP{,})$^*$  \emph{Varargs}\\ 
     807&$|$& \emph{MdParam}(\EXP{,} \emph{MdParam})$^*$\\ 
     808 
     809\emph{AbsMdParams} 
     810&::=& (\emph{AbsMdParam}\EXP{,})$^*$ \options{\emph{Varargs}\EXP{,}} \emph{MdKeyword}(\EXP{,}\emph{MdKeyword})$^*$\\ 
     811&$|$& (\emph{AbsMdParam}\EXP{,})$^*$  \emph{Varargs}\\ 
     812&$|$& \emph{AbsMdParam}(\EXP{,} \emph{AbsMdParam})$^*$\\ 
     813 
     814\emph{MdKeyword} &::=& \emph{MdParam}\EXP{=}\emph{Expr} \\ 
     815 
     816\emph{MdParam} &::=& \emph{Param} \\ 
     817&$|$& \KWD{self} \\ 
     818 
     819\emph{AbsMdParam} &::=& \KWD{self} \\ 
     820&$|$& \emph{AbsParam} \\ 
     821 
     822\emph{OpMdHeaderFront} 
     823&::=& \KWD{opr} \option{\KWD{BIG}} 
     824(\{\EXP{\mapsto} $|$ \emph{LeftEncloser} $|$ \emph{Encloser}) \option{\emph{StaticParams}} 
     825\option{\emph{Params}}\\ 
     826&& (\emph{RightEncloser} $|$ \emph{Encloser}) 
     827\options{\EXP{\ASSIGN} \texttt( \emph{SubscriptAssignParam} \texttt)} 
     828\\ 
     829&$|$& \KWD{opr} \emph{ValParam} 
     830(\emph{Op} $|$ \emph{ExponentOp}) \option{\emph{StaticParams}} \\ 
     831&$|$& \KWD{opr} \option{\KWD{BIG}} 
     832(\emph{Op} $|$ \texttt{\^} $|$ \emph{Encloser} $|$ $\sum$ $|$ $\prod$) 
     833 \option{\emph{StaticParams}} \emph{ValParam} \\ 
     834 
     835\emph{AbsOpMdHeaderFront} 
     836&::=& \KWD{opr} \option{\KWD{BIG}} 
     837(\{\EXP{\mapsto} $|$ \emph{LeftEncloser} $|$ \emph{Encloser}) \option{\emph{StaticParams}} 
     838\option{\emph{AbsParams}}\\ 
     839&& (\emph{RightEncloser} $|$ \emph{Encloser}) 
     840\options{\EXP{\ASSIGN} \texttt( \emph{AbsSubscriptAssignParam} \texttt)} 
     841\\ 
     842&$|$& \KWD{opr} \emph{AbsValParam} 
     843(\emph{Op} $|$ \emph{ExponentOp}) \option{\emph{StaticParams}} \\ 
     844&$|$& \KWD{opr} \option{\KWD{BIG}} 
     845(\emph{Op} $|$ \texttt{\^} $|$ \emph{Encloser} $|$ $\sum$ $|$ $\prod$) 
     846 \option{\emph{StaticParams}} \emph{AbsValParam} \\ 
     847 
     848\emph{SubscriptAssignParam} 
     849&::=& \emph{Varargs}\\ 
     850&$|$& \emph{Param}\\ 
     851 
     852\emph{AbsSubscriptAssignParam} 
     853&::=& \emph{Varargs}\\ 
     854&$|$& \emph{AbsParam}\\ 
     855\end{tabular} 
     856 
     857\section{Field Declarations} 
     858\begin{tabular}{lll} 
     859\emph{FldDecl} 
     860&::=& \option{\emph{FldMods}} \emph{FldWTypes} \emph{InitVal} \\ 
     861&$|$& \option{\emph{FldImmutableMods}} \emph{BindIdOrBindIdTuple} \EXP{=} \emph{Expr}\\ 
     862&$|$& \option{\emph{FldMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{Type}\EXP{...} 
     863\emph{InitVal} \\ 
     864&$|$& \option{\emph{FldMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{TupleType} 
     865\emph{InitVal} \\ 
     866 
     867\emph{FldWTypes} &::=& \emph{FldWType} \\ 
     868&$|$& \texttt{(} \emph{FldWType}(\EXP{,} \emph{FldWType})$^+$ \texttt{)}\\ 
     869 
     870\emph{FldWType} &::=& \emph{BindId} \emph{IsType}\\ 
     871 
     872\end{tabular} 
     873 
     874\section{Abstract Field Declarations} 
     875\begin{tabular}{lll} 
     876\emph{AbsFldDecl} 
     877&::=& \option{\emph{AbsFldMods}} \emph{AbsFldWTypes}\\ 
     878&$|$& \option{\emph{AbsFldMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{Type}\EXP{...}\\ 
     879&$|$& \option{\emph{AbsFldMods}} \emph{BindIdOrBindIdTuple} \EXP{\mathrel{\mathtt{:}}} \emph{TupleType}\\ 
     880 
     881\emph{AbsFldWTypes} &::=& \emph{AbsFldWType} \\ 
     882&$|$& \texttt{(} \emph{AbsFldWType}(\EXP{,} \emph{AbsFldWType})$^+$ \texttt{)}\\ 
     883 
     884\emph{AbsFldWType} &::=& \emph{BindId} \emph{IsType}\\ 
     885 
     886\emph{ApiFldDecl} &::=& \option{\emph{ApiFldMods}} \emph{BindId} \emph{IsType}\\ 
     887 
     888\end{tabular} 
     889 
     890\section{Expressions} 
     891\begin{tabular}{lll} 
     892\emph{Expr} 
     893&::=& \emph{AssignExpr}\\ 
     894&$|$& \emph{OpExpr}\\ 
     895&$|$& \emph{DelimitedExpr}\\ 
     896&$|$& \emph{FlowExpr}\\ 
     897&$|$& \KWD{fn} \emph{ValParam} \option{\emph{IsType}} \option{\emph{Throws}} \EXP{\Rightarrow} \emph{Expr}\\ 
     898&$|$& \emph{Expr} \KWD{as} \emph{Type}\\ 
     899&$|$& \emph{Expr} \KWD{asif} \emph{Type}\\ 
     900 
     901\emph{AssignExpr} 
     902&::=& \emph{AssignLefts} \emph{AssignOp} \emph{Expr}\\ 
     903 
     904\emph{AssignLefts} 
     905&::=& \texttt( \emph{AssignLeft}(\EXP{,} \emph{AssignLeft})$^*$ \texttt)\\ 
     906&$|$& \emph{AssignLeft}\\ 
     907 
     908\emph{AssignLeft} 
     909&::=& \emph{SubscriptExpr}\\ 
     910&$|$& \emph{FieldSelection}\\ 
     911&$|$& \emph{QualifiedName}\\ 
     912 
     913\emph{SubscriptExpr} &::=& 
     914\emph{Primary} \emph{LeftEncloser} \option{\emph{StaticArgs}} \option{\emph{ExprList}} \emph{RightEncloser} \\ 
     915 
     916\emph{FieldSelection} &::=& \emph{Primary}\EXP{.}\emph{Id}\\ 
     917 
     918\emph{OpExpr} 
     919&::=& \emph{EncloserOp} \option{\emph{OpExpr}} \option{\emph{EncloserOp}} \\ 
     920&$|$& \emph{OpExpr} \emph{EncloserOp} \option{\emph{OpExpr}} \\ 
     921&$|$& \emph{Primary}\\ 
     922 
     923\emph{EncloserOp} &::=& \emph{Encloser}\\ 
     924&$|$& \emph{Op}\\ 
     925 
     926\emph{Primary} 
     927&::=& \emph{PrimaryItem} (\EXP{,} \emph{PrimaryItem})$^*$\\ 
     928 
     929\emph{PrimaryItem} 
     930&::=& \emph{ArrayExpr}\\ 
     931&$|$& \emph{MapExpr} \\ 
     932&$|$& \emph{Comprehension} \\ 
     933&$|$& \emph{LeftEncloser} \option{\emph{StaticArgs}} \option{\emph{ExprList}} \emph{RightEncloser} \\ 
     934&$|$& \emph{ParenthesisDelimited}\\ 
     935&$|$& \emph{LiteralExpr}\\ 
     936&$|$& \emph{VarOrFnRef}\\ 
     937&$|$& \KWD{self} \\ 
     938&$|$& \emph{Primary} \emph{LeftEncloser} \option{\emph{StaticArgs}} \option{\emph{ExprList}} \emph{RightEncloser} \\ 
     939&$|$& \emph{Primary}\EXP{.}\emph{Id} 
     940\option{\emph{StaticArgs}} \emph{ParenthesisDelimited}\\ 
     941&$|$& \emph{Primary}\EXP{.}\emph{Id}\\ 
     942&$|$& \emph{Primary} \verb+^+ \emph{Exponent}\\ 
     943&$|$& \emph{Primary} \emph{ExponentOp}\\ 
     944&$|$& \emph{Primary} \emph{ArgExpr}\\ 
     945&$|$& \emph{Primary} \emph{Primary}\\ 
     946 
     947\emph{VarOrFnRef} &::=& \emph{Id} \option{\emph{StaticArgs}}\\ 
     948 
     949\end{tabular} 
     950 
     951\begin{tabular}{lll} 
     952\emph{ParenthesisDelimited} 
     953&::=& \emph{Parenthesized}\\ 
     954&$|$& \emph{ArgExpr}\\ 
     955&$|$& \texttt(\texttt)\\ 
     956 
     957\emph{Exponent} 
     958&::=& \emph{ParenthesisDelimited}\\ 
     959&$|$& \emph{LiteralExpr}\\ 
     960&$|$& \emph{Id}\\ 
     961&$|$& \KWD{self}\\ 
     962 
     963\emph{FlowExpr} 
     964&::=& \KWD{exit} \option{\emph{Id}} \options{\KWD{with} \emph{Expr}} \\ 
     965&$|$& \emph{Accumulator} \option{\emph{StaticArgs}} 
     966\options{\texttt[ \emph{GeneratorClauseList} \texttt]} \emph{Expr} \\ 
     967&$|$& \KWD{atomic} \emph{AtomicBack}\\ 
     968&$|$& \KWD{tryatomic} \emph{AtomicBack} \\ 
     969&$|$& \KWD{spawn} \emph{Expr} \\ 
     970&$|$& \KWD{throw} \emph{Expr}\\ 
     971 
     972\emph{AtomicBack} 
     973&::=& \emph{AssignExpr}\\ 
     974&$|$& \emph{OpExpr}\\ 
     975&$|$& \emph{DelimitedExpr}\\ 
     976 
     977\emph{GeneratorClauseList} &::=& \emph{GeneratorBinding}(\EXP{,} \emph{GeneratorClause})$^*$\\ 
     978 
     979\emph{GeneratorBinding} 
     980&::=& \emph{BindIdOrBindIdTuple}\EXP{\leftarrow}\emph{Expr} \\ 
     981 
     982\emph{GeneratorClause} 
     983&::=& \emph{GeneratorBinding}\\ 
     984&$|$& \emph{Expr} \\ 
     985 
     986\end{tabular} 
     987 
     988\section{Expressions Enclosed by Keywords or Symbols} 
     989\begin{tabular}{lll} 
     990\emph{DelimitedExpr} 
     991&::=& \emph{ArgExpr}\\ 
     992&$|$& \emph{Parenthesized}\\ 
     993&$|$& \KWD{object} \option{\emph{ExtendsWhere}} 
     994\option{\emph{GoInAnObject}} \KWD{end} \\ 
     995&$|$& \emph{Do}\\ 
     996&$|$& \KWD{label} \emph{Id} \emph{BlockElems} \KWD{end} \emph{Id} \\ 
     997&$|$& \KWD{while} \emph{GeneratorClause} \emph{Do} \\ 
     998&$|$& \KWD{for} \emph{GeneratorClauseList} \emph{DoFront} \KWD{end}\\ 
     999&$|$& \KWD{if} \emph{GeneratorClause} \KWD{then} \emph{BlockElems} \option{\emph{Elifs}} \option{\emph{Else}} \KWD{end}\\ 
     1000&$|$& \texttt{(}\KWD{if} \emph{GeneratorClause} \KWD{then} \emph{BlockElems} 
     1001\option{\emph{Elifs}} \emph{Else} \option{\KWD{end}}\texttt{)}\\ 
     1002&$|$& \KWD{case} \emph{Expr} \option{(\emph{Encloser} $|$ \emph{Op})} \KWD{of} \emph{CaseClauses} 
     1003\option{\emph{CaseElse}} \KWD{end} \\ 
     1004&$|$& \KWD{case} \KWD{most} (\emph{Encloser} $|$ \emph{Op}) \KWD{of} 
     1005\emph{CaseClauses} \KWD{end}\\ 
     1006&$|$& \KWD{typecase} \emph{TypecaseBindings} \KWD{of} 
     1007\emph{TypecaseClauses} \option{\emph{CaseElse}} \KWD{end}\\ 
     1008&$|$& \KWD{try} \emph{BlockElems} \option{\emph{Catch}} 
     1009\options{\KWD{forbid} \emph{TraitTypes}} 
     1010\options{\KWD{finally} \emph{BlockElems}} \KWD{end} \\ 
     1011 
     1012\emph{Do} &::=& (\emph{DoFront} \KWD{also})$^*$ \emph{DoFront} \KWD{end}\\ 
     1013 
     1014\emph{DoFront} &::=& \options{\KWD{at} \emph{Expr}} \option{\KWD{atomic}} 
     1015\KWD{do} \option{\emph{BlockElems}}\\ 
     1016 
     1017\emph{ArgExpr} &::=& 
     1018\texttt( (\emph{Expr}\EXP{,})$^*$ \options{\emph{Expr}\EXP{...}\EXP{,}} 
     1019\emph{KeywordExpr} (\EXP{,} \emph{KeywordExpr})$^*$ \texttt)\\ 
     1020&$|$& \emph{TupleExpr}\\ 
     1021&$|$& \texttt( (\emph{Expr}\EXP{,})$^*$ \emph{Expr}\EXP{...} \texttt)\\ 
     1022 
     1023\emph{TupleExpr} 
     1024&::=& \texttt( (\emph{Expr}\EXP{,})$^+$ \emph{Expr} \texttt)\\ 
     1025 
     1026\emph{KeywordExpr} &::=& \emph{BindId} \EXP{=} \emph{Expr}\\ 
     1027 
     1028\emph{Parenthesized} &::=& \texttt( \emph{Expr} \texttt)\\ 
     1029 
     1030\emph{Elifs} &::=& \emph{Elif}$^+$\\ 
     1031 
     1032\emph{Elif} &$::=$& \KWD{elif} \emph{GeneratorClause} \KWD{then} \emph{BlockElems}\\ 
     1033 
     1034\emph{Else} &$::=$& \KWD{else} \emph{BlockElems}\\ 
     1035 
     1036\emph{CaseClauses} &::=& \emph{CaseClause}$^+$\\ 
     1037 
     1038\emph{CaseClause} &::=& \emph{Expr} \EXP{\Rightarrow} \emph{BlockElems}\\ 
     1039 
     1040\emph{CaseElse} &::=& \KWD{else} \EXP{\Rightarrow} \emph{BlockElems}\\ 
     1041 
     1042\end{tabular} 
     1043 
     1044\begin{tabular}{lll} 
     1045\emph{TypecaseBindings} &::=& \emph{TypecaseVars} 
     1046\options{\EXP{=} \emph{Expr}}\\ 
     1047 
     1048\emph{TypecaseVars} &::=& \emph{BindId} \\ 
     1049&$|$& \texttt{(} \emph{BindId}(\EXP{,} \emph{BindId})$^+$ \texttt{)} \\ 
     1050 
     1051\emph{TypecaseClauses} &::=& \emph{TypecaseClause}$^+$\\ 
     1052 
     1053\emph{TypecaseClause} &::=& 
     1054\emph{TypecaseTypes} \EXP{\Rightarrow} \emph{BlockElems} \\ 
     1055 
     1056\emph{TypecaseTypes} 
     1057&::=& \texttt{(} \emph{TypeList} \texttt{)}\\ 
     1058&$|$& \emph{Type} \\ 
     1059 
     1060\emph{Catch} &::=& \KWD{catch} \emph{BindId} \emph{CatchClauses}\\ 
     1061 
     1062\emph{CatchClauses} &::=& \emph{CatchClause}$^+$\\ 
     1063 
     1064\emph{CatchClause} &::=& \emph{TraitType} \EXP{\Rightarrow} \emph{BlockElems} \\ 
     1065 
     1066\emph{MapExpr} &::=& \{ \option{\emph{StaticArgs}} \option{\emph{EntryList}} \}\\ 
     1067 
     1068\emph{Comprehension} 
     1069&::=& \option{\KWD{BIG}} \texttt{[} \option{\emph{StaticArgs}} 
     1070\emph{ArrayComprehensionClause}$^+$ \texttt{]}\\ 
     1071&$|$& \option{\KWD{BIG}} \{ \option{\emph{StaticArgs}} 
     1072\emph{Entry} \texttt{|} \emph{GeneratorClauseList} \} \\ 
     1073&$|$& \option{\KWD{BIG}} \emph{LeftEncloser} \option{\emph{StaticArgs}} 
     1074\emph{Expr} \texttt{|} \emph{GeneratorClauseList} \emph{RightEncloser} \\ 
     1075 
     1076\emph{Entry} &::=& \emph{Expr} \ensuremath{\mapsto} \emph{Expr} \\ 
     1077 
     1078\emph{ArrayComprehensionClause} &::=& 
     1079\emph{ArrayComprehensionLeft} \texttt{|} \emph{GeneratorClauseList}\\ 
     1080 
     1081\emph{ArrayComprehensionLeft} &::=& 
     1082\emph{IdOrInt} \ensuremath{\mapsto} \emph{Expr}\\ 
     1083&$|$& \texttt( \emph{IdOrInt}\EXP{,} \emph{IdOrIntList} \texttt) \ensuremath{\mapsto} \emph{Expr}\\ 
     1084 
     1085\emph{IdOrInt} &::=& \emph{Id}\\ 
     1086&$|$& \emph{IntLiteralExpr}\\ 
     1087 
     1088\emph{IdOrIntList} &::=& \emph{IdOrInt}(\EXP{,} \emph{IdOrInt})$^*$ \\ 
     1089 
     1090\emph{ExprList} &::=& \emph{Expr}(\EXP{,} \emph{Expr})$^*$ \\ 
     1091 
     1092\emph{EntryList} &::=& \emph{Entry}(\EXP{,} \emph{Entry})$^*$ \\ 
     1093 
     1094\end{tabular} 
     1095 
     1096\section{Local Declarations} 
     1097\begin{tabular}{lll} 
     1098\emph{BlockElems} &::=& \emph{BlockElem}$^+$ \\ 
     1099 
     1100\emph{BlockElem} 
     1101&::=& \emph{LocalVarFnDecl}\\ 
     1102&$|$& \emph{Expr}\options{\EXP{,} \emph{GeneratorClauseList}}\\ 
     1103 
     1104\emph{LocalVarFnDecl} 
     1105&::=& \emph{LocalFnDecl}$^+$\\ 
     1106&$|$& \emph{LocalVarDecl}\\ 
     1107 
     1108\emph{LocalFnDecl} &::=& 
     1109\option{\emph{LocalFnMods}} \emph{NamedFnHeaderFront} \emph{FnHeaderClause} \EXP{=} 
     1110\emph{Expr} \\ 
     1111 
     1112\emph{LocalVarDecl} 
     1113&::=& \option{\KWD{var}} \emph{LocalVarWTypes} \emph{InitVal} \\ 
     1114&$|$& \option{\KWD{var}} \emph{LocalVarWTypes}\\ 
     1115&$|$& \emph{LocalVarWoTypes} \EXP{=} \emph{Expr} \\ 
     1116&$|$& \option{\KWD{var}} \emph{LocalVarWoTypes} \EXP{\mathrel{\mathtt{:}}} \emph{Type}\EXP{...} 
     1117\option{\emph{InitVal}} \\ 
     1118&$|$& \option{\KWD{var}} \emph{LocalVarWoTypes} \EXP{\mathrel{\mathtt{:}}} \emph{TupleType} 
     1119\option{\emph{InitVal}} \\ 
     1120 
     1121\emph{LocalVarWTypes} &::=& \emph{LocalVarWType} \\ 
     1122&$|$& \texttt{(} \emph{LocalVarWType}(\EXP{,} \emph{LocalVarWType})$^+$ \texttt{)}\\ 
     1123\emph{LocalVarWType} &::=& \emph{BindId} \emph{IsType}\\ 
     1124 
     1125\emph{LocalVarWoTypes} &::=& \emph{LocalVarWoType} \\ 
     1126&$|$& \texttt{(} \emph{LocalVarWoType}(\EXP{,} \emph{LocalVarWoType})$^+$ \texttt{)}\\ 
     1127\emph{LocalVarWoType} &::=& \emph{BindId}\\ 
     1128&$|$& \emph{Unpasting} \\ 
     1129 
     1130\emph{Unpasting} &::=& \texttt{[} \emph{UnpastingElems} \texttt{]} \\ 
     1131 
     1132\emph{UnpastingElems} 
     1133&::=& \emph{UnpastingElem} \emph{RectSeparator} \emph{UnpastingElems} \\ 
     1134&$|$& \emph{UnpastingElem} \\ 
     1135 
     1136\emph{UnpastingElem} 
     1137&::=& \emph{BindId} \options{\texttt{[} \emph{UnpastingDim} \texttt{]}} \\ 
     1138&$|$& \emph{Unpasting} \\ 
     1139 
     1140\emph{UnpastingDim} &::=& \emph{ExtentRange} (\BY\ \emph{ExtentRange})$^+$ \\ 
     1141 
     1142\end{tabular} 
     1143 
     1144\section{Literals} 
     1145\begin{tabular}{lll} 
     1146\emph{LiteralExpr} &::=& \texttt{(} \texttt{)}\\ 
     1147&$|$& \emph{NumericLiteralExpr}\\ 
     1148&$|$& \emph{CharLiteralExpr}\\ 
     1149&$|$& \emph{StringLiteralExpr}\\ 
     1150 
     1151\emph{ArrayExpr} &::=& 
     1152\texttt{[} \option{\emph{StaticArgs}} \emph{RectElements} \texttt{]}\\ 
     1153 
     1154\emph{RectElements} &::=& \emph{Expr} \emph{MultiDimCons}$^*$\\ 
     1155 
     1156\emph{MultiDimCons} &::=& \emph{RectSeparator} \emph{Expr}\\ 
     1157\end{tabular} 
     1158 
     1159\section{Types} 
     1160\begin{tabular}{lll} 
     1161\emph{Type} 
     1162&::=& \emph{TypeRef} \\ 
     1163&$|$& \emph{TraitType} \\ 
     1164&$|$& \emph{TupleType} \\ 
     1165&$|$& \texttt( \emph{Type} \texttt) \\ 
     1166&$|$& \texttt{()} \\ 
     1167&$|$& \emph{ArgType} \EXP{\rightarrow} \emph{Type}  \option{\emph{Throws}}\\ 
     1168&$|$& \emph{Type} \emph{DimType} \\ 
     1169 
     1170\emph{TypeRef} 
     1171&::=& \emph{DottedId} \option{\emph{StaticArgs}}\\ 
     1172 
     1173\emph{TraitType} 
     1174&::=& \emph{TypeRef}\\ 
     1175&$|$& \emph{Type} \texttt{[} \option{\emph{ArraySize}} \texttt{]} \\ 
     1176&$|$& \emph{Type} \verb+^+ \emph{IntExpr}\\ 
     1177&$|$& \emph{Type} \verb+^+ \texttt{(} \emph{ExtentRange} 
     1178(\EXP{\times} \emph{ExtentRange})$^*$ \texttt{)}\\ 
     1179 
     1180\emph{ArgType} 
     1181&::=& \texttt{(} (\emph{Type}\EXP{,})$^*$ 
     1182\options{\emph{Type}\EXP{...}\EXP{,}} 
     1183\emph{KeywordType}(\EXP{,} \emph{KeywordType})$^*$ \texttt{)}\\ 
     1184&$|$& \texttt{(} (\emph{Type}\EXP{,})$^*$ 
     1185\emph{Type}\EXP{...} \texttt{)}\\ 
     1186&$|$& \emph{TupleType} \\ 
     1187 
     1188\emph{KeywordType} &::-& \emph{BindId}\EXP{=}\emph{Type}\\ 
     1189 
     1190\emph{TupleType} &::=& 
     1191\texttt{(} \emph{Type}\EXP{,} \emph{TypeList} \texttt{)}\\ 
     1192 
     1193\emph{TypeList} &::=& \emph{Type}(\EXP{,} \emph{Type})$^*$ \\ 
     1194 
     1195\emph{ArraySize} &::=& \emph{ExtentRange}(\EXP{,} \emph{ExtentRange})$^*$ \\ 
     1196 
     1197\emph{ExtentRange} 
     1198&::=& \option{\emph{StaticArg}}\EXP{\mathinner{\hbox{\tt\char'43}}} 
     1199\option{\emph{StaticArg}}\\ 
     1200&$|$& \option{\emph{StaticArg}}\KWD:\option{\emph{StaticArg}}\\ 
     1201&$|$& \emph{StaticArg} \\ 
     1202 
     1203\emph{DimType} 
     1204&::=& \emph{DottedId} \\ 
     1205&$|$& \texttt( \emph{DimType} \texttt) \\ 
     1206&$|$& \EXP{1} \\ 
     1207&$|$& \emph{DimPrefixOp} \emph{DimType} \\ 
     1208&$|$& \emph{DimType} \emph{DimInfixOp} \emph{DimType} \\ 
     1209&$|$& \emph{DimType} \emph{DimPostfixOp} \\ 
     1210&$|$& \emph{DimType} \KWD{in} \emph{Expr}\\ 
     1211 
     1212\emph{DimPrefixOp} &::=& \KWD{square} $|$ \KWD{cubic} $|$ \KWD{inverse} \\ 
     1213\emph{DimInfixOp} &::=& $\csdot$ $|$ \EXP{/} $|$ \KWD{per} \\ 
     1214\emph{DimPostfixOp} &::=& \KWD{squared} $|$ \KWD{cubed} \\ 
     1215 
     1216\end{tabular} 
     1217 
     1218\section{Symbols and Operators} 
     1219\begin{tabular}{lll} 
     1220 
     1221\emph{EncloserPair} &::=& 
     1222(\emph{LeftEncloser} $|$ \emph{Encloser}) \option{\EXP{\cdot}} 
     1223(\emph{RightEncloser} $|$ \emph{Encloser})\\ 
     1224 
     1225\emph{ExponentOp} &::=& \verb+^T+ $|$ \verb+^+(\emph{Encloser} $|$ \emph{Op})\\ 
     1226 
     1227\emph{AssignOp} &::=& \EXP{\ASSIGN} $|$ (\emph{Encloser} $|$ \emph{Op})\EXP{=}\\ 
     1228 
     1229\emph{Accumulator} &::=& $\sum$ $|$ $\prod$ $|$ \KWD{BIG} (\emph{Encloser} $|$ \emph{Op})\\ 
     1230\end{tabular} 
     1231 
     1232\section{Identifiers} 
     1233\begin{tabular}{lll} 
     1234\emph{BindId} &::=& \emph{Id}\\ 
     1235&$|$& \KWD{\_}\\ 
     1236 
     1237\emph{BindIdList} &::=& \emph{BindId}(\EXP{,} \emph{BindId})$^*$\\ 
     1238 
     1239\emph{BindIdOrBindIdTuple} 
     1240&::=& \emph{BindId}\\ 
     1241&$|$& \texttt{(} \emph{BindId}\EXP{,} \emph{BindIdList} \texttt{)}\\ 
     1242 
     1243\emph{SimpleName} &::=& \emph{Id} \\ 
     1244&$|$& \KWD{opr} \option{\KWD{BIG}} (\emph{Encloser} $|$ \emph{Op}) \\ 
     1245&$|$& \KWD{opr} \option{\KWD{BIG}} \emph{EncloserPair} \\ 
     1246 
     1247\emph{APIName} &::=& \emph{Id}(\EXP{.}\emph{Id})$^*$\\ 
     1248 
     1249\emph{QualifiedName} &::=& \emph{Id}(\EXP{.}\emph{Id})$^*$\\ 
     1250\end{tabular} 
     1251 
     1252\section{Spaces and Comments} 
     1253\begin{tabular}{lll} 
     1254\emph{RectSeparator} &::=& \EXP{;}+\\ 
     1255&$|$& \emph{Whitespace}\\ 
     1256\end{tabular} 
  • trunk/Specification/basic/components/components.tex

    r4271 r4301  
    1818\chapter{Components and APIs} 
    1919\chaplabel{components} 
     20 
     21\input{\home/basic/components/intro} 
     22\input{\home/basic/components/overview} 
     23\input{\home/basic/components/source-code} 
     24\input{\home/basic/components/tests} 
     25\input{\home/basic/components/type-inference} 
     26\input{\home/basic/components/initialization} 
     27\input{\home/basic/components/basic} 
     28\input{\home/basic/components/advanced} 
  • trunk/Specification/fortress/fortress.bib

    r4295 r4301  
    1616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    1717 
     18@inproceedings{fgj, 
     19  author = "Atshushi Igarashi and Benjamin Pierce and Philip Wadler", 
     20  title = "{Featherweight Java}: {A} Minimal Core Calculus for {Java} and {GJ}", 
     21  booktitle = "Proceedings of the 1999 {ACM} {SIGPLAN} Conference on Object-Oriented Programming, Systems, Languages {\&} Applications ({OOPSLA}`99)", 
     22  volume = "34(10)", 
     23  address = "N. Y.", 
     24  editor = "Loren Meissner", 
     25  pages = "132--146", 
     26  year = "1999", 
     27  url = "citeseer.ist.psu.edu/igarashi99featherweight.html" 
     28} 
     29 
    1830@Misc{Fortress, 
    1931  author = "Eric Allen and David Chase and Joe Hallett and Victor Luchangco and Jan-Willem Maessen and Sukyoung Ryu and Guy L. Steele Jr. and Sam Tobin-Hochstadt", 
     
    2436  howpublished = "\url{http://research.sun.com/projects/plrg/Publications/fortress.1.0.pdf}" 
    2537} 
     38 
     39@misc{FortressInterpreter, 
     40  author = "Sun's Programming Language Research Group", 
     41  title = "Project Fortress", 
     42  howpublished = "\url{http://projectfortress.sun.com}" } 
    2643 
    2744@book{JLS, 
     
    3855} 
    3956 
     57@InProceedings{MFFF-RTA04, 
     58  author =       "J. Matthews and R. B. Findler and M. Flatt and M. 
     59                 Felleisen", 
     60  title =        "{A Visual Environment for Developing Context-Sensitive 
     61                 Term Rewriting Systems (system description)}", 
     62  pages =        "301--311", 
     63  year =         "2004", 
     64  month =        jun # "~3-5,", 
     65  editor =       "V. van Oostrom", 
     66  booktitle =    "{Rewriting Techniques and Applications, 15th 
     67                 International Conference, RTA-04}", 
     68  address =      "Valencia, Spain", 
     69  series =       "LNCS 3091", 
     70  ISBN =         "3-540-22153-0", 
     71  publisher =    "Springer", 
     72} 
     73 
     74@techreport{nistSP811, 
     75  author = "Barry N. Taylor", 
     76  title = "Guide for the Use of the International System of Units (SI)", 
     77  institution = "United States Department of Commerce, National Institute of Standards and Technology", 
     78  month = apr, 
     79  year = 1995, 
     80  url = "http://physics.nist.gov/cuu/pdf/sp811.pdf" 
     81} 
     82 
     83@misc{Rats, 
     84  author = "Robert Grimm", 
     85  title = "Rats! -- An Easily Extensible Parser Generator", 
     86  howpublished = "\url{http://cs.nyu.edu/~rgrimm/xtc/rats.html}" } 
     87 
    4088@book{Unicode, 
    4189  Year = {2006}, 
  • trunk/Specification/latex-common/macros/all-macros.tex

    r4271 r4301  
    1717 
    1818\input{\macros/macros} 
    19 % \input{\macros/spec-macros} 
    20 % \input{\macros/component-macros} 
    21 % \input{\macros/calculus-macros} 
     19\input{\macros/spec-macros} 
     20\input{\macros/calculus-macros} 
  • trunk/Specification/latex-common/macros/macros.tex

    r4295 r4301  
    3434%Literal text 
    3535\newcommand{\txt}[1]{\mbox{\ttfamily\small{#1}}} 
    36 % \newcommand{\A}[1]{\underline{\texttt{#1}}} 
    37 % \newcommand{\txtr}[1]{\mbox{\ttfamily{#1}}} 
    38 % \newcommand{\csdot}{\thinspace\cdot\thinspace} 
    39 % \newcommand{\scap}[1]{\textsc{#1}} 
     36\newcommand{\A}[1]{\underline{\texttt{#1}}} 
     37\newcommand{\txtr}[1]{\mbox{\ttfamily{#1}}} 
     38\newcommand{\csdot}{\thinspace\cdot\thinspace} 
     39\newcommand{\scap}[1]{\textsc{#1}} 
     40 
     41% Tabbing in teletype font, so we can embed formulas, italics, roman, etc... 
     42\newenvironment{ttt}{% 
     43\begin{tt} 
     44\begin{tabbing} 
     45}{% 
     46\end{tabbing} 
     47\end{tt} 
     48} 
     49 
     50%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     51%% brackets, braces, and parentheses %%%%%%%%%%%%%%%%%%%%%%%%% 
     52%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     53\newcommand{\set}[1]{\ensuremath{\{#1\}}} 
     54\newcommand{\braces}[1]{\ensuremath{\code\{#1\code\}}} 
     55\newcommand{\parens}[1]{\ensuremath{\code(#1\code)}} 
     56\newcommand{\brackets}[1]{\ensuremath{\code[#1\code]}} 
     57%% brackets for type parameters 
     58\newcommand{\bTPl}{\ensuremath{\llbracket}} 
     59\newcommand{\bTPr}{\ensuremath{\rrbracket}} 
     60\newcommand{\bsTP}[1]{\bTPl#1\bTPr} 
     61\newcommand{\bINTl}{\ensuremath{\langle\!|}} 
     62\newcommand{\bINTr}{\ensuremath{|\!\rangle}} 
     63\newcommand{\bsINT}[1]{\bINTl#1\bINTr} 
     64%% brackets for lists 
     65\newcommand{\bLISTl}{\ensuremath{\langle}} 
     66\newcommand{\bLISTr}{\ensuremath{\rangle}} 
     67\newcommand{\bsLIST}[1]{\bLISTl#1\bLISTr} 
     68%% brackets for where clauses 
     69\newcommand{\bWHl}{\ensuremath{\{}} 
     70\newcommand{\bWHr}{\ensuremath{\}}} 
     71\newcommand{\bsWH}[1]{\bWHl#1\bWHr} 
     72 
     73%% Numeric type names 
     74\newcommand{\ZZ}{\ensuremath{\mathbb{Z}}} 
     75\newcommand{\RR}{\ensuremath{\mathbb{R}}} 
     76 
     77\newcommand{\AmBYn}[3]{$\txtr{#1}^{\txtr{#2}\BY\txtr{#3}}$} 
     78\newcommand{\aSUBmBYn}[3]{$\txtr{#1}_{\txtr{#2}\BY\txtr{#3}}$} 
    4079 
    4180%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     
    5291\newcommand{\option}[1]{#1?} 
    5392\newcommand{\options}[1]{(#1)?} 
     93 
    5494 
    5595\def\Grammar{\list{}{\leftmargin 2em 
     
    97137\newcommand\Function{\librarysubsection} 
    98138\newcommand\Variable{\librarysubsection} 
     139 
     140%%%%%%%%%%%%%%%%%%%%% 
     141%% API vs api %%%%%%% 
     142%%%%%%%%%%%%%%%%%%%%% 
     143\newcommand{\apiN}{\mbox{API}} 
     144\newcommand{\apisN}{\mbox{APIs}} 
     145\newcommand{\Api}{API} 
     146\newcommand{\Apis}{APIs} 
     147 
     148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     149%% mathematical characters not already covered by LaTeX %%%%%%% 
     150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     151\newcommand{\OverStrike}[2]{{\setbox1\hbox{${#1}$}\setbox2\hbox{${#2}$}\relax 
     152   \setbox3\vbox{\box1\box2}\hbox{\hbox to \wd3{\hfil${#1}$\hfil}\hskip-\wd3 
     153                                  \hbox to \wd3{\hfil${#2}$\hfil}}}} 
     154\newcommand{\UPTRI}{\vbox to 0pt{\vss\hbox{\raise 0.1em\hbox{\large$\bigtriangleup$}}}} 
     155\newcommand{\DOWNTRI}{\vbox to 0pt{\vss\hbox{\lower 0.2em\hbox{\large$\bigtriangledown$}}}} 
     156 
     157\newcommand{\upplus}{\mathbin{\OverStrike{\UPTRI}{\scriptstyle +}}} 
     158\newcommand{\upminus}{\mathbin{\OverStrike{\UPTRI}{\scriptstyle -}}} 
     159\newcommand{\uptimes}{\mathbin{\OverStrike{\UPTRI}{\scriptstyle\times}}} 
     160\newcommand{\updot}{\mathbin{\OverStrike{\UPTRI}{\cdot}}} 
     161\newcommand{\upslash}{\mathbin{\OverStrike{\UPTRI}{\scriptstyle\diagup}}} 
     162\newcommand{\downplus}{\mathbin{\OverStrike{\DOWNTRI}{\raise0.1ex\hbox{$\scriptstyle +$}}}} 
     163\newcommand{\downminus}{\mathbin{\OverStrike{\DOWNTRI}{\raise0.1ex\hbox{$\scriptstyle -$}}}} 
     164\newcommand{\downtimes}{\mathbin{\OverStrike{\DOWNTRI}{\raise0.1ex\hbox{$\scriptstyle\times$}}}} 
     165\newcommand{\downdot}{\mathbin{\OverStrike{\DOWNTRI}{\raise0.1ex\hbox{$\cdot$}}}} 
     166\newcommand{\downslash}{\mathbin{\OverStrike{\DOWNTRI}{\raise0.1ex\hbox{$\scriptstyle\diagup$}}}} 
     167\newcommand{\chopplus}{\mathbin{\OverStrike{\sqcup}{\raise0.1ex\hbox{$\scriptstyle +$}}}} 
     168\newcommand{\chopminus}{\mathbin{\OverStrike{\sqcup}{\raise0.1ex\hbox{$\scriptstyle -$}}}} 
     169\newcommand{\choptimes}{\mathbin{\OverStrike{\sqcup}{\raise0.1ex\hbox{$\scriptstyle\times$}}}} 
     170\newcommand{\chopdot}{\mathbin{\OverStrike{\sqcup}{\raise0.1ex\hbox{$\cdot$}}}} 
     171\newcommand{\chopslash}{\mathbin{\OverStrike{\sqcup}{\raise0.1ex\hbox{$\scriptstyle\diagup$}}}} 
     172\newcommand{\exactplus}{\mathbin{\OverStrike{\diamond}{\scriptstyle +}}} 
     173\newcommand{\exactminus}{\mathbin{\OverStrike{\diamond}{\scriptstyle -}}} 
     174\newcommand{\exacttimes}{\mathbin{\OverStrike{\diamond}{\scriptstyle\times}}} 
     175\newcommand{\exactdot}{\mathbin{\OverStrike{\diamond}{\cdot}}} 
     176\newcommand{\exactslash}{\mathbin{\OverStrike{\diamond}{\scriptstyle\diagup}}} 
     177\newcommand{\totallss}{\mathbin{\OverStrike{\bigcirc}{\scriptstyle>}}} 
     178\newcommand{\totalleq}{\mathbin{\OverStrike{\bigcirc}{\scriptstyle\leq}}} 
     179\newcommand{\totalgeq}{\mathbin{\OverStrike{\bigcirc}{\scriptstyle\geq}}} 
     180\newcommand{\totalgtr}{\mathbin{\OverStrike{\bigcirc}{\scriptstyle<}}} 
     181\newcommand{\xor}{\mathbin{\underline{\vee}}} 
     182\newcommand{\nand}{\mathbin{\overline{\wedge}}} 
     183\newcommand{\nor}{\mathbin{\overline{\vee}}} 
     184\newcommand{\twointersectand}{\mathbin{\wedge\mskip-8mu\wedge}} 
     185\newcommand{\twointersector}{\mathbin{\vee\mskip-8mu\vee}} 
     186\newcommand{\twointersectxor}{\mathbin{\underline{\vee\mskip-8mu\vee}}} 
     187\newcommand{\twointersectnot}{\mathbin{\OverStrike{\raise0.3ex\hbox{$\neg$}}{\lower0.2ex\hbox{$\neg$}}}} 
     188\newcommand{\lhfloor}{\mathopen{\lfloor\mskip-1.8\thinmuskip\lfloor}} 
     189\newcommand{\rhfloor}{\mathclose{\rfloor\mskip-1.8\thinmuskip\rfloor}} 
     190\newcommand{\lhceil}{\mathopen{\lceil\mskip-1.8\thinmuskip\lceil}} 
     191\newcommand{\rhceil}{\mathclose{\rceil\mskip-1.8\thinmuskip\rceil}} 
     192\newcommand{\lhhfloor}{\mathopen{\lfloor\mskip-1.8\thinmuskip\lfloor\mskip-1.8\thinmuskip\lfloor}} 
     193\newcommand{\rhhfloor}{\mathclose{\rfloor\mskip-1.8\thinmuskip\rfloor\mskip-1.8\thinmuskip\rfloor}} 
     194\newcommand{\lhhceil}{\mathopen{\lceil\mskip-1.8\thinmuskip\lceil\mskip-1.8\thinmuskip\lceil}} 
     195\newcommand{\rhhceil}{\mathclose{\rceil\mskip-1.8\thinmuskip\rceil\mskip-1.8\thinmuskip\rceil}} 
     196\newcommand{\dotminus}{\mathbin{\dot{-}}} 
     197\newcommand{\dottimes}{\mathbin{\dot{\times}}} 
     198%\newcommand{\sequiv}{\mathrel{\OverStrike{\raise0.45ex\hbox{$=$}}{\lower0.4ex\hbox{$=$}}}} 
     199 
     200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     201%% object trait vs object trait type %%%%% 
     202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     203\newcommand{\objecttype}{object trait type} 
     204\newcommand{\objecttypes}{object trait types} 
     205 
     206%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     207%% identifier parameter %%%%% 
     208%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
     209\newcommand{\nameparam}{\KWD{ident}} 
     210 
     211%Token 
     212\newcommand{\T}[1]{\textsc{#1}} 
     213%Nonterminal 
     214\newcommand{\N}[1]{\textit{#1}} 
     215 
     216%subscripted nonterminals 
     217\newcommand{\NS}[1]{$\textit{#1}_\sigma$} 
     218\newcommand{\NWO}[1]{$\textit{#1}_{\not\hookleftarrow}$} 
     219\newcommand{\NWN}[1]{$\textit{#1}_{\emptyset}$} 
     220 
     221% Whitespace glyphs 
     222\newcommand{\WW}{$\Diamond$}%Any white, including empty 
     223\newcommand{\WP}{$\Box$}%Non-empty white 
     224\newcommand{\WO}{$\not\hookleftarrow$}%Any white except newline 
     225\newcommand{\WN}{$\emptyset$}%White containing at least one newline 
     226\newcommand{\NL}{$\hookleftarrow$}%A new line 
     227 
     228%Troublesome characters 
     229\newcommand{\OR}{$|$} 
     230\newcommand{\GT}{>} 
     231\newcommand{\LT}{<} 
     232\newcommand{\HAT}{\boldmath$\hat{\ }$} 
     233\def\BY{\ensuremath{\times}}