Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    re229c22 r0638c44  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri Jun  3 09:49:31 2016
    14 %% Update Count     : 281
     13%% Last Modified On : Tue May  3 08:05:33 2016
     14%% Update Count     : 246
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    3030\usepackage{textcomp}
    3131\usepackage[latin1]{inputenc}
    32 \usepackage{fullpage,times,comment}
     32\usepackage{upquote}
     33\usepackage{fullpage,times}
    3334\usepackage{epic,eepic}
    34 \usepackage{upquote}                                                                    % switch curled `' to straight `'
    3535\usepackage{xspace}
    36 \usepackage{varioref}                                                                   % extended references
    37 \usepackage{listings}                                                                   % format program code
    38 \usepackage{footmisc}                                                                   % support label/reference in footnote
    39 \usepackage{latexsym}                                   % \Box glyph
     36\usepackage{varioref}
     37\usepackage{listings}
     38\usepackage{footmisc}
     39\usepackage{comment}
     40\usepackage{latexsym}                                   % \Box
    4041\usepackage{mathptmx}                                   % better math font with "times"
    4142\usepackage[pagewise]{lineno}
     
    112113The syntax of the \CFA language builds from C, and should look immediately familiar to C programmers.
    113114% Any language feature that is not described here can be assumed to be using the standard C11 syntax.
    114 \CFA adds many modern programming-language features that directly leads to increased \emph{safety} and \emph{productivity}, while maintaining interoperability with existing C programs and achieving C performance.
     115\CFA adds many modern programming-language features, which directly leads to increased safety and productivity, while maintaining interoperability with existing C programs and achieving C performance.
    115116Like C, \CFA is a statically typed, procedural language with a low-overhead runtime, meaning there is no global garbage-collection.
    116117The primary new features include parametric-polymorphism routines and types, exceptions, concurrency, and modules.
     
    243244The 1999 C standard plus GNU extensions.
    244245\item\hspace*{-4pt}\Indexc{-fgnu89-¶inline¶}\index{compilation option!-fgnu89-inline@{©-fgnu89-¶inline¶©}}
    245 Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files.
     246Use the traditional GNU semantics for inline routines in C99 mode.
    246247\end{description}
    247248The following new \CFA option is available:
     
    11731174Unfortunately, this restriction forces programmers to use ©goto© to achieve the equivalent for more than one level of nesting.
    11741175To prevent having to make this switch, the ©break© and ©continue© are extended with a target label to support static multi-level exit~\cite{Buhr85,Java}.
    1175 \VRef[Figure]{f:LabelledBreak} shows the labelled ©break©, and the target control structure of the exit.
    1176 The inner most loop has three exit points, which cause termination of one or more of the three nested loops, respectively.
    1177 \VRef[Figure]{f:LabelledContinue} shows the labelled ©continue©, and which control structure is the target of the next loop iteration.
    1178 The inner most loop has three restart points, which cause the next loop iteration to begin, respectively.
    1179 
    1180 \begin{figure}
    1181 \centering
     1176For the labelled ©break©, it is possible to specify which control structure is the target for exit, as in:
     1177\begin{quote2}
    11821178\begin{tabular}{@{}l@{\hspace{30pt}}l@{}}
    11831179\multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}       & \multicolumn{1}{c}{\textbf{C}}        \\
     
    12001196                        ... goto L1; ...
    12011197                        ... goto L2; ...
    1202                         ... goto L3; // or break 
     1198                        ... goto L3; // or break
    12031199                } L3: ;
    12041200        } L2: ;
     
    12061202\end{lstlisting}
    12071203\end{tabular}
    1208 \caption{Labelled Break}
    1209 \label{f:LabelledBreak}
    1210 
    1211 \vspace*{0.25in}
    1212 
     1204\end{quote2}
     1205The inner most loop has three exit points, which cause termination of one or more of the three nested loops, respectively.
     1206For the labelled ©continue©, it is possible to specify which control structure is the target for the next loop iteration, as in:
     1207\begin{quote2}
    12131208\begin{tabular}{@{}l@{\hspace{30pt}}l@{}}
    12141209\multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}       & \multicolumn{1}{c}{\textbf{C}}        \\
     
    12191214                        ... continue ®L1®; ...
    12201215                        ... continue ®L2®; ...
    1221                         ... continue ®L3®; // or continue
     1216                        ... continue ®L3®; ...
    12221217
    12231218                }
     
    12341229                        ... goto L1; ...
    12351230                        ... goto L2; ...
    1236                         ... goto L3; // or continue
     1231                        ... goto L3; ...
    12371232                  L3: ;
    12381233                }
     
    12431238\end{lstlisting}
    12441239\end{tabular}
    1245 \caption{Labelled Continue}
    1246 \label{f:LabelledContinue}
    1247 \end{figure}
    1248 
     1240\end{quote2}
     1241The inner most loop has three restart points, which cause the next loop iteration to begin, respectively.
    12491242For both ©break© and ©continue©, the target label must be directly associated with a ©for©, ©while© or ©do© statement;
    12501243for ©break©, the target label can also be associated with a ©switch© statement.
     
    33363329\begin{lstlisting}
    33373330struct Line {
    3338         float lnth;
     3331        float length;
    33393332}
    33403333// default constructor
    33413334void ?{}( Line * l ) {
    3342         l->lnth = 0.0;
    33433335        sout | "default" | endl;
     3336        l.length = 0.0;
    33443337}
    33453338
    33463339
    33473340// constructor with length
    3348 void ?{}( Line * l, float lnth ) {
    3349         l->lnth = lnth;
    3350         sout | "lnth" | l->lnth | endl;
    3351 
     3341void ?{}( Line * l, float length ) {
     3342        sout | "length" | length | endl;
     3343
     3344        l.length = length;
    33523345}
    33533346
    33543347// destructor
    3355 void ^?() {
     3348void ^?(Line &l) {
    33563349        sout | "destroyed" | endl;
    3357         l.lnth = 0.0;
     3350        l.length = 0.0;
    33583351}
    33593352
    33603353// usage
    33613354Line line1;
    3362 Line line2 = { 3.4 };
     3355Line line2{ 3.4 };
    33633356\end{lstlisting}
    33643357&
    33653358\begin{lstlisting}[language=C++]
    33663359class Line {
    3367         float lnth;
     3360        float length;
    33683361
    33693362        // default constructor
    33703363        Line() {
    33713364                cout << "default" << endl;
    3372                 lnth = 0.0;
     3365                length = 0.0;
    33733366        }
    33743367
    33753368
    3376         // constructor with lnth
     3369        // constructor with length
    33773370        Line( float l ) {
    33783371                cout << "length " << length
Note: See TracChangeset for help on using the changeset viewer.