Changes in / [24e7b47:b762122]
- Files:
-
- 1 added
- 5 edited
-
doc/refrat/Makefile (modified) (3 diffs)
-
doc/refrat/refrat.tex (modified) (15 diffs)
-
doc/refrat/xref.tex (added)
-
src/GenPoly/Specialize.cc (modified) (4 diffs)
-
src/SymTab/Indexer.h (modified) (2 diffs)
-
src/SynTree/Expression.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/refrat/Makefile
r24e7b47 rb762122 7 7 ## Define the text source files. 8 8 9 SOURCE S= ${addsuffix .tex, \9 SOURCE = ${addsuffix .tex, \ 10 10 refrat \ 11 11 } … … 32 32 33 33 clean : 34 rm -f *.bbl *.aux *.dvi *.idx *.ilg *.ind *.brf *.out *.log *.toc *.blg *.pstex_t \ 35 ${FIGURES} ${PICTURES} ${PROGRAMS} ${GRAPHS} ${basename ${DOCUMENT}}.ps ${DOCUMENT} 34 rm -f *.bbl *.aux *.dvi *.idx *.ilg *.ind *.brf *.out *.log *.toc *.blg *.pstex_t ${FIGURES} ${PICTURES} ${PROGRAMS} ${GRAPHS} ${basename ${DOCUMENT}}.ps ${DOCUMENT} 36 35 37 36 # File Dependencies # … … 43 42 dvips $< -o $@ 44 43 45 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex ${basename ${DOCUMENT}}.bib 46 # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run. 44 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCE} ${basename ${DOCUMENT}}.bbl 45 ${LaTeX} ${basename $@}.tex 46 if fgrep -s "Label(s) may have changed" ${basename $@}.log ; then ${LaTeX} ${basename $@}.tex ; fi 47 makeindex -s indexstyle ${basename $@}.idx 48 ${LaTeX} ${basename $@}.tex 49 ${LaTeX} ${basename $@}.tex % to get index title in toc 50 51 ${basename ${DOCUMENT}}.bbl : ${basename ${DOCUMENT}}.tex ${basename ${DOCUMENT}}.bib 47 52 if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi 48 # Must have *.aux file containing citations for bibtex49 53 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi 50 54 -${BibTeX} ${basename $@} 51 # Some citations reference others so run steps again to resolve these citations52 55 ${LaTeX} ${basename $@}.tex 53 56 -${BibTeX} ${basename $@} 54 # Make index from *.aux entries and input index at end of document55 makeindex -s indexstyle ${basename $@}.idx56 ${LaTeX} ${basename $@}.tex57 # Run again to get index title into table of contents58 ${LaTeX} ${basename $@}.tex59 57 60 58 ## Define the default recipes. -
doc/refrat/refrat.tex
r24e7b47 rb762122 2 2 3 3 \documentclass[openright,twoside]{report} 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 6 % Latex packages used in the document.7 8 4 \usepackage{fullpage,times} 9 5 \usepackage{xspace} … … 18 14 \urlstyle{sf} 19 15 20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 21 22 % Names used in the document. 23 24 \newcommand{\CFA}{Cforall\xspace} % set language text name 25 \newcommand{\CFAA}{C$\forall$\xspace} % set language symbolic name 26 \newcommand{\CC}{C\kern-.1em\hbox{+\kern-.25em+}\xspace} % CC symbolic name 27 \def\c11{ISO/IEC C} % C11 name (cannot have numbers in latex command name) 28 29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 30 31 % Specialized macros used in the document. 32 33 \newcommand{\italic}[1]{\emph{\hyperpage{#1}}} 34 \newcommand{\definition}[1]{\textbf{\hyperpage{#1}}} 35 \newcommand{\see}[1]{\emph{see} #1} 36 37 \makeatletter 38 % Define some commands that produce formatted index entries suitable for cross-references. 39 % ``\spec'' produces entries for specifications of entities. ``\impl'' produces entries for their 40 % implementations, and ``\use'' for their uses. 41 42 % \newcommand{\bold}[1]{{\bf #1}} 43 % \def\spec{\@bsphack\begingroup 44 % \def\protect##1{\string##1\space}\@sanitize 45 % \@wrxref{|bold}} 46 \def\impl{\@bsphack\begingroup 47 \def\protect##1{\string##1\space}\@sanitize 48 \@wrxref{|definition}} 49 \newcommand{\indexcode}[1]{{\lstinline$#1$}} 50 \def\use{\@bsphack\begingroup 51 \def\protect##1{\string##1\space}\@sanitize 52 \@wrxref{|hyperpage}} 53 \def\@wrxref#1#2{\let\thepage\relax 54 \xdef\@gtempa{\write\@indexfile{\string 55 \indexentry{#2@{\lstinline$#2$}#1}{\thepage}}}\endgroup\@gtempa 56 \if@nobreak \ifvmode\nobreak\fi\fi\@esphack} 57 \makeatother 58 %\newcommand{\use}[1]{\index{#1@{\lstinline$#1$}}} 59 %\newcommand{\impl}[1]{\index{\protect#1@{\lstinline$\protect#1$}|definition}} 16 %\input code.sty 17 \input xref.tex 60 18 61 19 \newcommand{\define}[1]{\emph{#1\/}\index{#1}} … … 79 37 \def\syntax{\paragraph{Syntax}\trivlist\parindent=.5in\item[\hskip.5in]} 80 38 \let\endsyntax=\endtrivlist 81 \newcommand{\lhs}[1]{\par{\ emph{#1:}}\index{#1@{\emph{#1}}|italic}}39 \newcommand{\lhs}[1]{\par{\it #1:}\index{#1@{\it #1}|italic}} 82 40 \newcommand{\rhs}{\hfil\break\hbox{\hskip1in}} 83 \newcommand{\oldlhs}[1]{ \emph{#1: \ldots}\index{#1@{\emph{#1}}|italic}}84 \newcommand{\nonterm}[1]{ \emph{#1\/}\index{#1@{\emph{#1}}|italic}}41 \newcommand{\oldlhs}[1]{{\it #1: \ldots}\index{#1@{\it #1}|italic}} 42 \newcommand{\nonterm}[1]{{\it #1\/}\index{#1@{\it #1}|italic}} 85 43 \newcommand{\opt}{$_{opt}$\ } 86 44 … … 94 52 \newcommand{\VPageref}[2][page]{\ifx#1\@empty\else{#1}\nobreakspace\fi\pageref{#2}} 95 53 54 \newcommand{\CFA}{Cforall\xspace} 55 \newcommand{\CFAA}{C$\forall$\xspace} 56 \newcommand{\CC}{C\kern-.1em\hbox{+\kern-.25em+}\xspace} 57 \def\c11{ISO/IEC C}% cannot have numbers in latex command name 58 96 59 % replace/adjust characters that look bad in sanserif 97 60 \makeatletter … … 100 63 \lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than 101 64 \lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than 102 \lst@ProcessOther{"5E}{ \raisebox{0.4ex}{$\scriptstyle\land\,$}} % circumflex65 \lst@ProcessOther{"5E}{$\sim$} % circumflex 103 66 \lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore 104 %\lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde 105 \lst@ProcessOther{"7E}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}} % lower tilde 67 \lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde 106 68 \@empty\z@\@empty 107 69 … … 112 74 113 75 \lstdefinelanguage{CFA}[ANSI]{C}% 114 {morekeywords={asm,_Atomic,catch,catchResume,choose,_Complex,context,disable,dtype,enable, 115 fallthru,finally,forall,ftype,_Imaginary,lvalue,restrict,throw,throwResume,try,type,}, 76 {morekeywords={asm,_Atomic,catch,choose,_Complex,context,dtype,fallthru,forall,ftype,_Imaginary,lvalue,restrict,throw,try,type,}, 116 77 } 117 78 … … 123 84 xleftmargin=\parindent, 124 85 escapechar=@, 125 %fancyvrb=true,126 86 %showtabs=true, 127 keepspaces=true, 128 showtabs=true, 129 tab=, 87 %tab=\rightarrowfill, 130 88 } 131 89 … … 133 91 \setcounter{tocdepth}{3} % subsubsections in table of contents 134 92 \makeindex 135 136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%137 93 138 94 \begin{document} … … 735 691 736 692 \examples 737 The expression \lstinline$(void *)0 $\use{0} specializes the (polymorphic) null pointer to a null693 The expression \lstinline$(void *)0}$\use{0} specializes the (polymorphic) null pointer to a null 738 694 pointer to \lstinline$void$. \lstinline$(const void *)0$ does the same, and also uses a safe 739 695 conversion from \lstinline$void *$ to \lstinline$const void *$. In each case, the null pointer … … 2469 2425 2470 2426 The operands of the expression ``\lstinline$a || b$'' are treated as ``\lstinline$(int)((a)!=0)$'' 2471 and ``\lstinline$(int)((b ))!=0)$'', which shall both be unambiguous. The expression has only one2427 and ``\lstinline$(int)((b})!=0)$'', which shall both be unambiguous. The expression has only one 2472 2428 interpretation, which is of type \lstinline$int$. 2473 2429 … … 4080 4036 \section{Statements and blocks} 4081 4037 4082 \begin{syntax}4083 \oldlhs{statement}4084 \rhs \nonterm{exception-statement}4085 \end{syntax}4086 4087 4038 Many statements contain expressions, which may have more than one interpretation. The following 4088 4039 sections describe how the \CFA translator selects an interpretation. In all cases the result of the … … 4090 4041 4091 4042 4092 \subsection{Labeled statements} 4093 4094 \begin{syntax} 4095 \oldlhs{labeled-statement} 4096 \rhs \lstinline$case$ \nonterm{case-value-list} : \nonterm{statement} 4097 \lhs{case-value-list} 4098 \rhs \nonterm{case-value} 4099 \rhs \nonterm{case-value-list} \lstinline$,$ \nonterm{case-value} 4100 \lhs{case-value} 4101 \rhs \nonterm{constant-expression} 4102 \rhs \nonterm{subrange} 4103 \lhs{subrange} 4104 \rhs \nonterm{constant-expression} \lstinline$~$ \nonterm{constant-expression} 4105 \end{syntax} 4106 4107 The following have identical meaning: 4108 \begin{lstlisting} 4109 case 1: case 2: case 3: case 4: case 5: 4110 case 1, 2, 3, 4, 5: 4111 case 1~5: 4112 \end{lstlisting} 4113 Multiple subranges are allowed: 4114 \begin{lstlisting} 4115 case 1~4, 9~14, 27~32: 4116 \end{lstlisting} 4117 The \lstinline$case$ and \lstinline$default$ clauses are restricted within the \lstinline$switch$ and \lstinline$choose$ statements, precluding Duff's device. 4118 4119 4043 \setcounter{subsection}{2} 4120 4044 \subsection{Expression and null statements} 4121 4045 … … 4125 4049 \subsection{Selection statements} 4126 4050 4127 \begin{syntax} 4128 \oldlhs{selection-statement} 4129 \rhs \lstinline$choose$ \lstinline$($ \nonterm{expression} \lstinline$)$ \nonterm{statement} 4130 \end{syntax} 4131 4132 The controlling expression \lstinline$E$ in the \lstinline$switch$ and \lstinline$choose$ statement: 4051 The controlling expression \lstinline$E$ in the switch statement 4133 4052 \begin{lstlisting} 4134 4053 switch ( E ) ... 4135 choose ( E ) ... 4136 \end{lstlisting} 4137 may have more than one interpretation, but it shall have only one interpretation with an integral type. 4138 An \Index{integer promotion} is performed on the expression if necessary. 4139 The constant expressions in \lstinline$case$ statements with the switch are converted to the promoted type. 4140 4141 4142 \setcounter{subsubsection}{3} 4143 \subsubsection{The \lstinline$choose$ statement} 4144 4145 The \lstinline$choose$ statement is the same as the \lstinline$switch$ statement except control transfers to the end of the \lstinline$choose$ statement at a \lstinline$case$ or \lstinline$default$ labeled statement. 4146 The \lstinline$fallthru$ statement is used to fall through to the next \lstinline$case$ or \lstinline$default$ labeled statement. 4147 The following have identical meaning: 4148 \begin{flushleft} 4149 \begin{tabular}{@{\hspace{2em}}l@{\hspace{2em}}l@{}} 4150 \begin{lstlisting} 4151 switch (...) { 4152 case 1: ... ; break; 4153 case 2: ... ; break; 4154 case 3: ... ; // fall through 4155 case 4: ... ; // fall through 4156 default: ... break; 4157 } 4158 \end{lstlisting} 4159 & 4160 \begin{lstlisting} 4161 choose (...) { 4162 case 1: ... ; // exit 4163 case 2: ... ; // exit 4164 case 3: ... ; fallthru; 4165 case 4: ... ; fallthru; 4166 default: ... ; // exit 4167 } 4168 \end{lstlisting} 4169 \end{tabular} 4170 \end{flushleft} 4171 The \lstinline$choose$ statement addresses the problem of accidental fall-through associated with the \lstinline$switch$ statement. 4054 \end{lstlisting} 4055 may have more than one interpretation, but it shall have only one interpretation with an integral 4056 type. An \Index{integer promotion} is performed on the expression if necessary. The constant 4057 expressions in \lstinline$case$ statements with the switch are converted to the promoted type. 4172 4058 4173 4059 … … 4188 4074 is treated as 4189 4075 \begin{lstlisting} 4190 for ( ( void )( a ); ( int )(( b )!=0); ( void )( c ) ) ...4076 for ( ( void )( a ); ( int )(( b )!=0); ( void )( c ) ) @\ldots@ 4191 4077 \end{lstlisting} 4192 4078 … … 4194 4080 \subsection{Jump statements} 4195 4081 4196 \begin{syntax} 4197 \oldlhs{jump-statement} 4198 \rhs \lstinline$continue$ \nonterm{identifier}\opt 4199 \rhs \lstinline$break$ \nonterm{identifier}\opt 4200 \rhs \ldots 4201 \rhs \lstinline$throw$ \nonterm{assignment-expression}\opt 4202 \rhs \lstinline$throwResume$ \nonterm{assignment-expression}\opt \nonterm{at-expression}\opt 4203 \lhs{at-expression} \lstinline$_At$ \nonterm{assignment-expression} 4204 \end{syntax} 4205 4206 Labeled \lstinline$continue$ and \lstinline$break$ allow useful but restricted control-flow that reduces the need for the \lstinline$goto$ statement for exiting multiple nested control-structures. 4207 \begin{lstlisting} 4208 L1: { // compound 4209 L2: switch ( ... ) { // switch 4210 case ...: 4211 L3: for ( ;; ) { // outer for 4212 L4: for ( ;; ) { // inner for 4213 continue L1; // error: not enclosing iteration 4214 continue L2; // error: not enclosing iteration 4215 continue L3; // next iteration of outer for 4216 continue L4; // next iteration of inner for 4217 break L1; // exit compound 4218 break L2; // exit switch 4219 break L3; // exit outer for 4220 break L4; // exit inner for 4221 } // for 4222 } // for 4223 break; // exit switch 4224 default: 4225 break L1; // exit compound 4226 } // switch 4227 ... 4228 } // compound 4229 \end{lstlisting} 4230 4231 4232 \setcounter{subsubsection}{1} 4233 \subsubsection{The \lstinline$continue$ statement} 4234 4235 The identifier in a \lstinline$continue$ statement shall name a label located on an enclosing iteration statement. 4236 4237 4238 \subsubsection{The \lstinline$break$ statement} 4239 4240 The identifier in a \lstinline$break$ statement shall name a label located on an enclosing compound, selection or iteration statement. 4241 4242 4243 \subsubsection{The \lstinline$return$ statement} 4244 4245 An expression in a \lstinline$return$ statement is treated as being cast to the result type of the function. 4246 4247 4248 \subsubsection{The \lstinline$throw$ statement} 4249 4250 When an exception is raised, \Index{propagation} directs control from a raise in the source execution to a handler in the faulting execution. 4251 4252 4253 \subsubsection{The \lstinline$throwResume$ statement} 4254 4255 4256 \subsection{Exception statements} 4257 4258 \begin{syntax} 4259 \lhs{exception-statement} 4260 \rhs \lstinline$try$ \nonterm{compound-statement} \nonterm{handler-list} 4261 \rhs \lstinline$try$ \nonterm{compound-statement} \nonterm{finally-clause} 4262 \rhs \lstinline$try$ \nonterm{compound-statement} \nonterm{handler-list} \nonterm{finally-clause} 4263 \lhs{handler-list} 4264 \rhs \nonterm{handler-clause} 4265 \rhs \lstinline$catch$ \lstinline$($ \ldots \lstinline$)$ \nonterm{compound-statement} 4266 \rhs \nonterm{handler-clause} \lstinline$catch$ \lstinline$($ \ldots \lstinline$)$ \nonterm{compound-statement} 4267 \rhs \lstinline$catchResume$ \lstinline$($ \ldots \lstinline$)$ \nonterm{compound-statement} 4268 \rhs \nonterm{handler-clause} \lstinline$catchResume$ \lstinline$($ \ldots \lstinline$)$ \nonterm{compound-statement} 4269 \lhs{handler-clause} 4270 \rhs \lstinline$catch$ \lstinline$($ \nonterm{exception-declaration} \lstinline$)$ \nonterm{compound-statement} 4271 \rhs \nonterm{handler-clause} \lstinline$catch$ \lstinline$($ \nonterm{exception-declaration} \lstinline$)$ \nonterm{compound-statement} 4272 \rhs \lstinline$catchResume$ \lstinline$($ \nonterm{exception-declaration} \lstinline$)$ \nonterm{compound-statement} 4273 \rhs \nonterm{handler-clause} \lstinline$catchResume$ \lstinline$($ \nonterm{exception-declaration} \lstinline$)$ \nonterm{compound-statement} 4274 \lhs{finally-clause} 4275 \rhs \lstinline$finally$ \nonterm{compound-statement} 4276 \lhs{exception-declaration} 4277 \rhs \nonterm{type-specifier} 4278 \rhs \nonterm{type-specifier} \nonterm{declarator} 4279 \rhs \nonterm{type-specifier} \nonterm{abstract-declarator} 4280 \rhs \nonterm{new-abstract-declarator-tuple} \nonterm{identifier} 4281 \rhs \nonterm{new-abstract-declarator-tuple} 4282 \lhs{asynchronous-statement} 4283 \rhs \lstinline$enable$ \nonterm{identifier-list} \nonterm{compound-statement} 4284 \rhs \lstinline$disable$ \nonterm{identifier-list} \nonterm{compound-statement} 4285 \end{syntax} 4286 4287 \Index{Exception statement}s allow a dynamic call to a handler for \Index{recovery} (\Index{termination}) or \Index{correction} (\Index{resumption}) of an \Index{abnormal event}. 4288 4289 4290 \subsubsection{The \lstinline$try$ statement} 4291 4292 The \lstinline$try$ statement is a block with associated handlers, called a \Index{guarded block}; 4293 all other blocks are \Index{unguarded block}s. 4294 A \lstinline$goto$, \lstinline$break$, \lstinline$return$, or \lstinline$continue$ statement can be used to transfer control out of a try block or handler, but not into one. 4295 4296 4297 \subsubsection{The \lstinline$enable$/\lstinline$disable$ statements} 4298 4299 The \lstinline$enable$/\lstinline$disable$ statements toggle delivery of \Index{asynchronous exception}s. 4082 An expression in a \lstinline$return$ statement is treated as being 4083 cast to the result type of the function. 4300 4084 4301 4085 -
src/GenPoly/Specialize.cc
r24e7b47 rb762122 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Sep 22 14:04:13201513 // Update Count : 1511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 13 15:54:07 2015 13 // Update Count : 6 14 14 // 15 15 … … 86 86 87 87 Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) { 88 assert( ! actual->get_results().empty() );89 88 if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) { 90 89 PointerType *ptrType; … … 168 167 Expression * Specialize::mutate( AddressExpr *addrExpr ) { 169 168 addrExpr->get_arg()->acceptMutator( *this ); 170 assert( ! addrExpr->get_results().empty() );171 169 addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) ); 172 170 return addrExpr; … … 175 173 Expression * Specialize::mutate( CastExpr *castExpr ) { 176 174 castExpr->get_arg()->acceptMutator( *this ); 177 if ( ! castExpr->get_results().empty() ) { 178 // this may not be the correct condition, but previously the next statement 179 // was happening unchecked, causing a crash on a cast to void 180 castExpr->set_arg( doSpecialization( castExpr->get_results().front(), castExpr->get_arg() ) ); 181 } 175 castExpr->set_arg( doSpecialization( castExpr->get_results().front(), castExpr->get_arg() ) ); 182 176 return castExpr; 183 177 } -
src/SymTab/Indexer.h
r24e7b47 rb762122 10 10 // Created On : Sun May 17 21:38:55 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Sep 17 16:05:38201513 // Update Count : 512 // Last Modified On : Wed Aug 05 13:51:39 2015 13 // Update Count : 4 14 14 // 15 15 … … 19 19 #include <list> 20 20 #include <string> 21 #include <map> 21 22 22 23 #include "SynTree/Visitor.h" -
src/SynTree/Expression.cc
r24e7b47 rb762122 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Sep 02 12:07:10201513 // Update Count : 3 312 // Last Modified On : Wed Aug 12 14:02:45 2015 13 // Update Count : 30 14 14 // 15 15 … … 31 31 Expression::Expression( Expression *_aname ) : env( 0 ), argName( _aname ) {} 32 32 33 Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ) , argName( maybeClone( other.get_argName() ) ){33 Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ) { 34 34 cloneAll( other.results, results ); 35 argName = other.get_argName(); 35 36 } 36 37
Note:
See TracChangeset
for help on using the changeset viewer.