Skip to content

Commit 0cf0d8e

Browse files
committed
Rebasing
1 parent 889edb9 commit 0cf0d8e

File tree

1 file changed

+114
-21
lines changed

1 file changed

+114
-21
lines changed

specification/dart.sty

Lines changed: 114 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
\def\WITH{\keyword{with}}
6969
\def\YIELD{\keyword{yield}}
7070

71+
% Used for inline code snippets.
72+
\newcommand{\code}[1]{\texttt{#1}}
73+
7174
% Used to specify syntactic sugar.
7275
\def\LET{\keyword{let}}
7376
\newcommand{\Let}[3]{\code{\LET\,\,{#1}\,=\,{#2}\ \IN\ {#3}}}
@@ -78,8 +81,8 @@
7881
\newcommand{\LetMany}[5]{%
7982
\code{\LET\,\,{#1}\,=\,{#2},\ $\cdots$,\ {#3}\,=\,{#4}\ \IN\ {#5}}}
8083

81-
% Used for inline code snippets.
82-
\def\code#1{\texttt{#1}}
84+
% Used for inline meta-code snippets
85+
\newcommand{\metaCode}[1]{{\color{metaColor}\texttt{#1}}}
8386

8487
% `call` has no special lexical status, so we just use \code{}.
8588
\def\CALL{\code{call}}
@@ -112,6 +115,7 @@
112115
\definecolor{normativeColor}{rgb}{0,0,0}
113116
\definecolor{commentaryColor}{rgb}{0.5,0.5,0.5}
114117
\definecolor{rationaleColor}{rgb}{0.5,0.5,0.5}
118+
\definecolor{metaColor}{rgb}{0,0,1}
115119

116120
% Environments for different kinds of text.
117121
\newenvironment{Q}[1]{{\bf{}Upcoming: {#1}}}{}
@@ -132,22 +136,30 @@
132136
\newcommand{\Case}[1]{\textbf{Case }$\langle\hspace{0.1em}${#1}$\hspace{0.1em}\rangle$\textbf{.}}
133137
\newcommand{\EndCase}{\mbox{}\hfill$\scriptscriptstyle\Box$\xspace}
134138

135-
\newenvironment{dartCode}[1][!ht] {%
139+
\newenvironment{dartCode}[1][!ht]{%
136140
\def\@programcr{\@addfield\strut}%
137141
\let\\=\@programcr%
138142
\relax\@vobeyspaces\obeylines%
139143
\ttfamily\color{commentaryColor}%
140144
\vspace{1em}%
141145
}{\normalcolor\vspace{1em}}
142146

143-
\newenvironment{normativeDartCode}[1][!ht] {%
147+
\newenvironment{normativeDartCode}[1][!ht]{%
144148
\def\@programcr{\@addfield\strut}%
145149
\let\\=\@programcr%
146150
\relax\@vobeyspaces\obeylines%
147151
\ttfamily\color{normativeColor}%
148152
\vspace{1em}%
149153
}{\normalcolor\vspace{1em}}
150154

155+
\newenvironment{metaLevelCode}[1][!ht]{%
156+
\def\@programcr{\@addfield\strut}%
157+
\let\\=\@programcr%
158+
\relax\@vobeyspaces\obeylines%
159+
\ttfamily\color{metaColor}%
160+
\vspace{1em}%
161+
}{\normalcolor\vspace{1em}}
162+
151163
% Used for comments in a code context.
152164
\def\comment#1{\textsf{#1}}
153165

@@ -157,7 +169,7 @@
157169

158170
% Used for defining occurrence of phrase, with customized index entry.
159171
\newcommand{\IndexCustom}[2]{%
160-
\leavevmode\marginpar{\ensuremath{\diamond}}\emph{#1}\index{#2}}
172+
\leavevmode\marginpar{\ensuremath{_{^\vartriangle}}}\emph{#1}\index{#2}}
161173

162174
% Used for the defining occurrence of a local symbol.
163175
\newcommand{\DefineSymbol}[1]{%
@@ -178,7 +190,11 @@
178190

179191
% Same appearance, but not adding an entry to the index.
180192
\newcommand{\NoIndex}[1]{%
181-
\leavevmode\marginpar{\quad\ensuremath{\diamond}}\emph{#1}}
193+
\leavevmode\marginpar{\ensuremath{_{^\vartriangle}}}\emph{#1}}
194+
195+
% Mark a compile-time error in the margin.
196+
\newcommand{\Error}[1]{%
197+
\leavevmode\marginpar{\ensuremath{_{^\ominus}}}{#1}}
182198

183199
% Used to specify comma separated lists of similar symbols.
184200
\newcommand{\List}[3]{\ensuremath{{#1}_{#2},\,\ldots,\ {#1}_{#3}}}
@@ -190,6 +206,22 @@
190206
\newcommand{\PairList}[4]{\ensuremath{%
191207
{#1}_{#3}\ {#2}_{#3},\,\ldots,\ {#1}_{#4}\ {#2}_{#4}}}
192208

209+
% Used to specify named arguments.
210+
% Parameters: Parameter name, argument name, index at start, index at end.
211+
\newcommand{\NamedArgumentList}[4]{\PairList{#1}{\!\!:\,\,{#2}}{#3}{#4}}
212+
213+
% Used to specify an argument list including positional and named arguments.
214+
% Parameters: Argument name, number of positional arguments, named parameter
215+
% name, number of named arguments.
216+
\newcommand{\ArgumentList}[4]{%
217+
\List{#1}{1}{#2},\ \NamedArgumentList{#3}{#1}{{#2}+1}{{#2}+{#4}}}
218+
219+
% Used to specify a standard argument list.
220+
\newcommand{\ArgumentListStd}{\ArgumentList{a}{n}{x}{k}}
221+
222+
% Used to specify a standard type argument list.
223+
\newcommand{\TypeArgumentListStd}{\List{A}{1}{r}}
224+
193225
% Used to specify a list of tuples of the form $(K_j, V_j)$ which are
194226
% used with collection literals.
195227
\newcommand{\KeyValueTypeList}[4]{\ensuremath{%
@@ -279,26 +311,28 @@
279311

280312
% Used to specify function type parameter lists with named optionals.
281313
% Arguments: Parameter type, number of required parameters,
282-
% name of optional parameters, number of optional parameters.
283-
\newcommand{\FunctionTypeNamedArguments}[4]{%
284-
\List{#1}{1}{#2},\ \{\PairList{#1}{#3}{{#2}+1}{{#2}+{#4}}\}}
285-
314+
% name of optional parameters, number of optional parameters,
315+
% name of `required` symbol.
316+
\newcommand{\FunctionTypeNamedArguments}[5]{%
317+
\List{#1}{1}{#2},\ \{\TripleList{#5}{#1}{#3}{{#2}+1}{{#2}+{#4}}\}}
318+
286319
\newcommand{\FunctionTypeNamedArgumentsStd}{%
287-
\FunctionTypeNamedArguments{T}{n}{x}{k}}
320+
\FunctionTypeNamedArguments{T}{n}{x}{k}{r}}
288321

289322
% Used to specify function types with named parameters:
290323
% Arguments: Return type, spacer, type parameter name, bound name,
291324
% number of type parameters, parameter type, number of required parameters,
292-
% name of optional parameters, number of optional parameters.
325+
% name of optional parameters, number of optional parameters,
326+
% name of `required` symbol.
293327
\newcommand{\FunctionTypeNamed}[9]{%
294-
\FunctionType{#1}{#2}{#3}{#4}{#5}{%
295-
\FunctionTypeNamedArguments{#6}{#7}{#8}{#9}}}
328+
\FunctionType{#1}{#2}{#3}{#4}{#5}{\\
329+
\mbox{}\qquad\FunctionTypeNamedArguments{#6}{#7}{#8}{#9}{#10}}}
296330

297331
% Same as \FunctionType except suitable for inline usage, hence omitting
298332
% the spacer argument.
299-
\newcommand{\RawFunctionTypeNamed}[8]{%
333+
\newcommand{\RawFunctionTypeNamed}[9]{%
300334
\RawFunctionType{#1}{#2}{#3}{#4}{%
301-
\FunctionTypeNamedArguments{#5}{#6}{#7}{#8}}}
335+
\FunctionTypeNamedArguments{#5}{#6}{#7}{#8}{#9}}}
302336

303337
% Used to specify function types with no optional parameters:
304338
% Arguments: Return type, spacer, type parameter name, bound name,
@@ -314,10 +348,10 @@
314348
\RawFunctionTypePositional{#1}{X}{B}{s}{T}{n}{k}}
315349

316350
\newcommand{\FunctionTypeNamedStd}[1]{%
317-
\FunctionTypeNamed{#1}{ }{X}{B}{s}{T}{n}{x}{k}}
351+
\FunctionTypeNamed{#1}{ }{X}{B}{s}{T}{n}{x}{k}{r}}
318352

319353
\newcommand{\RawFunctionTypeNamedStd}[1]{%
320-
\RawFunctionTypeNamed{#1}{X}{B}{s}{T}{n}{x}{k}}
354+
\RawFunctionTypeNamed{#1}{X}{B}{s}{T}{n}{x}{k}{r}}
321355

322356
\newcommand{\FunctionTypeAllRequiredStd}[1]{%
323357
\FunctionTypeAllRequired{#1}{ }{X}{B}{s}{T}{n}}
@@ -326,7 +360,10 @@
326360
\FunctionTypePositional{#1}{\\}{X}{B}{s}{T}{n}{k}}
327361

328362
\newcommand{\FunctionTypeNamedStdCr}[1]{%
329-
\FunctionTypeNamed{#1}{\\}{X}{B}{s}{T}{n}{x}{k}}
363+
\FunctionTypeNamed{#1}{\\}{X}{B}{s}{T}{n}{x}{k}{r}}
364+
365+
\newcommand{\FunctionTypeNamedStdArgCr}[1]{%
366+
\FunctionTypeNamedArgCr{#1}{ }{X}{B}{s}{T}{n}{x}{k}{r}}
330367

331368
\newcommand{\FunctionTypeAllRequiredStdCr}[1]{%
332369
\FunctionTypeAllRequired{#1}{\\}{X}{B}{s}{T}{n}}
@@ -342,13 +379,13 @@
342379

343380
% Judgment expressing that a subtype relation exists.
344381
\newcommand{\Subtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:\,{#3}}}
345-
\newcommand{\SubtypeStd}[2]{\Subtype{\Gamma}{#1}{#2}}
382+
\newcommand{\SubtypeStd}[2]{\Subtype{\Delta}{#1}{#2}}
346383
% Subtype judgment where the environment is omitted (NE: "no environment").
347384
\newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
348385

349386
% Judgment expressing that a supertype relation exists.
350387
\newcommand{\Supertype}[3]{\ensuremath{{#1}\vdash{#2}\,:>\,{#3}}}
351-
\newcommand{\SupertypeStd}[2]{\Supertype{\Gamma}{#1}{#2}}
388+
\newcommand{\SupertypeStd}[2]{\Supertype{\Delta}{#1}{#2}}
352389

353390
% Judgment expressing that an assignability relation exists.
354391
\newcommand{\AssignableRelationSymbol}{\ensuremath{\Longleftrightarrow}}
@@ -394,6 +431,62 @@
394431
\ensuremath{{#2}}%
395432
}
396433

434+
\newcommand{\FlattenName}{\metavar{flatten}}
435+
\newcommand{\Flatten}[1]{\ensuremath{\FlattenName(\code{#1})}}
436+
437+
\newcommand{\NominalTypeDepthName}{\metavar{nominalTypeDepth}}
438+
\newcommand{\NominalTypeDepth}[1]{%
439+
\ensuremath{\NominalTypeDepthName(\code{#1})}}
440+
441+
\newcommand{\TopMergeTypeName}{\metavar{topMergeType}}
442+
\newcommand{\TopMergeType}[2]{%
443+
\ensuremath{\TopMergeTypeName(\code{{#1},\,\,{#2}})}}
444+
445+
\newcommand{\NonNullTypeName}{\metavar{nonNullType}}
446+
\newcommand{\NonNullType}[1]{\ensuremath{\NonNullTypeName(\code{#1})}}
447+
448+
\newcommand{\IsTopTypeName}{\metavar{isTopType}}
449+
\newcommand{\IsTopType}[1]{\ensuremath{\IsTopTypeName(\code{#1})}}
450+
451+
\newcommand{\IsObjectTypeName}{\metavar{isObjectType}}
452+
\newcommand{\IsObjectType}[1]{\ensuremath{\IsObjectTypeName(\code{#1})}}
453+
454+
\newcommand{\IsBottomTypeName}{\metavar{isBottomType}}
455+
\newcommand{\IsBottomType}[1]{\ensuremath{\IsBottomTypeName(\code{#1})}}
456+
457+
\newcommand{\IsNullTypeName}{\metavar{isNullType}}
458+
\newcommand{\IsNullType}[1]{\ensuremath{\IsNullTypeName(\code{#1})}}
459+
460+
\newcommand{\IsMoreTopTypeName}{\metavar{isMoreTopType}}
461+
\newcommand{\IsMoreTopType}[2]{%
462+
\ensuremath{\IsMoreTopTypeName(\code{{#1},\,\,{#2}})}}
463+
464+
\newcommand{\IsMoreBottomTypeName}{\metavar{isMoreBottomType}}
465+
\newcommand{\IsMoreBottomType}[2]{%
466+
\ensuremath{\IsMoreBottomTypeName(\code{{#1},\,\,{#2}})}}
467+
468+
\newcommand{\NormalizedTypeOfName}{\metavar{normalizedType}}
469+
\newcommand{\NormalizedTypeOf}[1]{%
470+
\ensuremath{\NormalizedTypeOfName(\code{#1})}}
471+
472+
\newcommand{\FutureValueTypeOfName}{\metavar{futureValueType}}
473+
\newcommand{\FutureValueTypeOf}[1]{%
474+
\ensuremath{\FutureValueTypeOfName(\code{#1})}}
475+
476+
\newcommand{\UpperBoundTypeName}{\metavar{standardUpperBound}}
477+
\newcommand{\UpperBoundType}[2]{%
478+
\ensuremath{\UpperBoundTypeName(\code{{#1},\,\,{#2}})}}
479+
480+
\newcommand{\LowerBoundTypeName}{\metavar{standardLowerBound}}
481+
\newcommand{\LowerBoundType}[2]{%
482+
\ensuremath{\LowerBoundTypeName(\code{{#1},\,\,{#2}})}}
483+
484+
\newcommand{\DefEquals}[2]{\ensuremath{{#1}\stackrel{\vartriangle}{=}{#2}}}
485+
\newcommand{\DefEqualsNewline}[2]{
486+
\ensuremath{{#1}\stackrel{\vartriangle}{=}}\\
487+
\ensuremath{{#2}}%
488+
}
489+
397490
% ----------------------------------------------------------------------
398491
% Support for hash valued Location Markers
399492

0 commit comments

Comments
 (0)