Changeset 8731d8c


Ignore:
Timestamp:
Apr 19, 2017, 2:39:05 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
e398777
Parents:
cd348e7 (diff), 4be3669 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
doc
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.tex

    rcd348e7 r8731d8c  
    1 
    21%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
    32%%
     
    1211%% Created On       : Sat Apr  9 10:06:17 2016
    1312%% Last Modified By : Peter A. Buhr
    14 %% Last Modified On : Wed Apr 12 11:32:26 2017
    15 %% Update Count     : 257
     13%% Last Modified On : Tue Apr 18 17:16:13 2017
     14%% Update Count     : 270
    1615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1716
     
    3736% Names used in the document.
    3837
    39 \newcommand{\CFA}{C$\mathbf\forall$\xspace} % set language symbolic name
    40 \newcommand{\CFL}{Cforall\xspace}               % set language text name
    41 \newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % CC symbolic name
     38\newcommand{\CFA}{C$\mathbf\forall$\xspace} % Cforall symbolic name
     39\newcommand{\CFL}{Cforall\xspace} % Cforall symbolic name
     40\newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name
    4241\newcommand{\CCeleven}{\rm C\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name
    4342\newcommand{\CCfourteen}{\rm C\kern-.1em\hbox{+\kern-.25em+}14\xspace} % C++14 symbolic name
    4443\newcommand{\CCseventeen}{\rm C\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name
    45 \newcommand{\CCtwenty}{\rm C\kern-.1em\hbox{+\kern-.25em+}20} % C++20 symbolic name
    46 \newcommand{\Celeven}{C11\xspace}               % C11 symbolic name
    47 \newcommand{\Csharp}{C\raisebox{-0.65ex}{\large$^\sharp$}\xspace}       % C# symbolic name
     44\newcommand{\CCtwenty}{\rm C\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name
     45\newcommand{\Celeven}{C11\xspace} % C11 symbolic name
     46\newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name
    4847
    4948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    5554\setlength{\parindentlnth}{\parindent}
    5655
    57 \newlength{\gcolumnposn}                                % temporary hack because lstlisting does handle tabs correctly
     56\newlength{\gcolumnposn}                                % temporary hack because lstlisting does not handle tabs correctly
    5857\newlength{\columnposn}
    5958\setlength{\gcolumnposn}{2.5in}
     
    274273belowskip=3pt,
    275274% replace/adjust listing characters that look bad in sanserif
    276 literate={-}{\raisebox{-0.15ex}{\texttt{-}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
    277         {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {_}{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    278         {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2,
     275literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     276        {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
     277        {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
    279278moredelim=**[is][\color{red}]{®}{®},                                    % red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
    280279moredelim=**[is][\color{blue}]{ß}{ß},                                   % blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
  • doc/generic_types/generic_types.tex

    rcd348e7 r8731d8c  
    8383belowskip=3pt,
    8484% replace/adjust listing characters that look bad in sanserif
    85 literate={-}{\makebox[1.4ex][c]{\raisebox{0.5ex}{\rule{1.2ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     85literate={-}{\makebox[1.4ex][c]{\raisebox{0.5ex}{\rule{1.2ex}{0.06ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
    8686        {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 % {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    87         {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1.4ex][c]{\raisebox{0.5ex}{\rule{1.2ex}{0.1ex}}}\kern-0.3ex\textgreater}2,
     87        {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1.4ex][c]{\raisebox{0.5ex}{\rule{1.2ex}{0.06ex}}}\kern-0.3ex\textgreater}2,
    8888moredelim=**[is][\color{red}]{`}{`},
    8989}% lstset
     
    285285if (x) x++                                                                      $\C{// if (x != 0) x += 1;}$
    286286\end{lstlisting}
    287 Every if and iteration statement in C compares the condition with @0@, and every increment and decrement operator is semantically equivalent to adding or subtracting the value @1@ and storing the result.
     287Every @if@ and iteration statement in C compares the condition with @0@, and every increment and decrement operator is semantically equivalent to adding or subtracting the value @1@ and storing the result.
    288288Due to these rewrite rules, the values @0@ and @1@ have the types @zero_t@ and @one_t@ in \CFA, which allows overloading various operations for new types that seamlessly connect to all special @0@ and @1@ contexts.
    289289The types @zero_t@ and @one_t@ have special built in implicit conversions to the various integral types, and a conversion to pointer types for @0@, which allows standard C code involving @0@ and @1@ to work as normal.
     
    398398The \CFA translator template-expands concrete generic-types into new structure types, affording maximal inlining.
    399399To enable inter-operation among equivalent instantiations of a generic type, the translator saves the set of instantiations currently in scope and reuses the generated structure declarations where appropriate.
    400 For example, a function declaration that accepts or returns a concrete generic-type produces a declaration for the instantiated struct in the same scope, which all callers may reuse.
     400A function declaration that accepts or returns a concrete generic-type produces a declaration for the instantiated structure in the same scope, which all callers may reuse.
    401401For example, the concrete instantiation for @pair( const char *, int )@ is:
    402402\begin{lstlisting}
     
    523523However, the \CFA type-system must support significantly more complex composition:
    524524\begin{lstlisting}
    525 [ int, int ] foo$\(_1\)$( int );
     525[ int, int ] foo$\(_1\)$( int );                        $\C{// overloaded foo functions}$
    526526[ double ] foo$\(_2\)$( int );
    527527void bar( int, double, double );
     
    772772Since @sum@\(_0\) does not accept any arguments, it is not a valid candidate function for the call @sum(10, 20, 30)@.
    773773In order to call @sum@\(_1\), @10@ is matched with @x@, and the argument resolution moves on to the argument pack @rest@, which consumes the remainder of the argument list and @Params@ is bound to @[20, 30]@.
    774 The process continues, @Params@ is bound to @[]@, requiring an assertion @int sum()@, which matches @sum@\(_0\) and terminates the recursion.
     774The process continues unitl @Params@ is bound to @[]@, requiring an assertion @int sum()@, which matches @sum@\(_0\) and terminates the recursion.
    775775Effectively, this algorithm traces as @sum(10, 20, 30)@ $\rightarrow$ @10 + sum(20, 30)@ $\rightarrow$ @10 + (20 + sum(30))@ $\rightarrow$ @10 + (20 + (30 + sum()))@ $\rightarrow$ @10 + (20 + (30 + 0))@.
    776776
     
    795795\end{lstlisting}
    796796Unlike C variadic functions, it is unnecessary to hard code the number and expected types.
    797 Furthermore, this code is extendable so any user-defined type with a @?+?@ operator.
     797Furthermore, this code is extendable for any user-defined type with a @?+?@ operator.
    798798Summing arbitrary heterogeneous lists is possible with similar code by adding the appropriate type variables and addition operators.
    799799
     
    998998On the other hand, C does not have a generic collections-library in its standard distribution, resulting in frequent reimplementation of such collection types by C programmers.
    999999\CCV does not use the \CC standard template library by construction, and in fact includes the definition of @object@ and wrapper classes for @bool@, @char@, @int@, and @const char *@ in its line count, which inflates this count somewhat, as an actual object-oriented language would include these in the standard library;
    1000 with their omission the \CCV line count is similar to C.
     1000with their omission, the \CCV line count is similar to C.
    10011001We justify the given line count by noting that many object-oriented languages do not allow implementing new interfaces on library types without subclassing or wrapper types, which may be similarly verbose.
    10021002
  • doc/user/user.tex

    rcd348e7 r8731d8c  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Wed Apr 12 12:18:58 2017
    14 %% Update Count     : 1415
     13%% Last Modified On : Tue Apr 18 17:17:24 2017
     14%% Update Count     : 1430
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    2525\usepackage{textcomp}
    2626\usepackage[latin1]{inputenc}
     27% Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
     28% removes it as a variable-name character so keyworks in variables are highlighted
     29\DeclareTextCommandDefault{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}
     30
    2731
    2832\usepackage{fullpage,times,comment}
Note: See TracChangeset for help on using the changeset viewer.