Changeset 0a208b8 for src


Ignore:
Timestamp:
May 25, 2017, 11:10:42 AM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
e883a4b
Parents:
a8e64c4 (diff), 58ed882 (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:/u/cforall/software/cfa/cfa-cc

Location:
src
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    ra8e64c4 r0a208b8  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu May 18 09:03:49 2017
    13  * Update Count     : 513
     12 * Last Modified On : Mon May 22 07:46:30 2017
     13 * Update Count     : 525
    1414 */
    1515
     
    377377"?"{op_binary_over}"?"  { IDENTIFIER_RETURN(); }                // binary
    378378        /*
    379           This rule handles ambiguous cases with operator identifiers, e.g., "int *?*?()", where the string "*?*?"
    380           can be lexed as "*"/"?*?" or "*?"/"*?". Since it is common practise to put a unary operator juxtaposed
    381           to an identifier, e.g., "*i", users will be annoyed if they cannot do this with respect to operator
    382           identifiers. Even with this special hack, there are 5 general cases that cannot be handled. The first
    383           case is for the function-call identifier "?()":
    384 
    385           int * ?()();  // declaration: space required after '*'
    386           * ?()();      // expression: space required after '*'
    387 
    388           Without the space, the string "*?()" is ambiguous without N character look ahead; it requires scanning
    389           ahead to determine if there is a '(', which is the start of an argument/parameter list.
    390 
    391           The 4 remaining cases occur in expressions:
    392 
    393           i++?i:0;              // space required before '?'
    394           i--?i:0;              // space required before '?'
    395           i?++i:0;              // space required after '?'
    396           i?--i:0;              // space required after '?'
    397 
    398           In the first two cases, the string "i++?" is ambiguous, where this string can be lexed as "i"/"++?" or
    399           "i++"/"?"; it requires scanning ahead to determine if there is a '(', which is the start of an argument
    400           list.  In the second two cases, the string "?++x" is ambiguous, where this string can be lexed as
    401           "?++"/"x" or "?"/"++x"; it requires scanning ahead to determine if there is a '(', which is the start of
    402           an argument list.
     379          This rule handles ambiguous cases with operator identifiers, e.g., "int *?*?()", where the string "*?*?"  can be
     380          lexed as "*?"/"*?" or "*"/"?*?". Since it is common practise to put a unary operator juxtaposed to an identifier,
     381          e.g., "*i", users will be annoyed if they cannot do this with respect to operator identifiers. Therefore, there is
     382          a lexical look-ahead for the second case, with backtracking to return the leading unary operator and then
     383          reparsing the trailing operator identifier.  Otherwise a space is needed between the unary operator and operator
     384          identifier to disambiguate this common case.
     385
     386          A similar issue occurs with the dereference, *?(...), and routine-call, ?()(...) identifiers.  The ambiguity
     387          occurs when the deference operator has no parameters, *?() and *?()(...), requiring arbitrary whitespace
     388          look-ahead for the routine-call parameter-list to disambiguate.  However, the dereference operator must have a
     389          parameter/argument to dereference *?(...).  Hence, always interpreting the string *?() as * ?() does not preclude
     390          any meaningful program.
     391
     392          The remaining cases are with the increment/decrement operators and conditional expression:
     393
     394          i++? ...(...);
     395          i?++ ...(...);
     396
     397          requiring arbitrary whitespace look-ahead for the operator parameter-list, even though that interpretation is an
     398      incorrect expression (juxtaposed identifiers).  Therefore, it is necessary to disambiguate these cases with a
     399      space:
     400
     401          i++ ? i : 0;
     402          i? ++i : 0;
    403403        */
    404 {op_unary}"?"({op_unary_pre_post}|"[?]"|{op_binary_over}"?") {
     404{op_unary}"?"({op_unary_pre_post}|"()"|"[?]"|{op_binary_over}"?") {
    405405        // 1 or 2 character unary operator ?
    406406        int i = yytext[1] == '?' ? 1 : 2;
  • src/libcfa/math

    ra8e64c4 r0a208b8  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 12:45:02 2016
    13 // Update Count     : 59
     12// Last Modified On : Wed May 24 17:40:39 2017
     13// Update Count     : 60
    1414//
    1515
     
    2020#include <math.h>                                                                               // fpclassify, isfinite, isnormal, isnan, isinf
    2121} // extern "C"
    22 
    23 float fabs( float );
    24 // extern "C" { double fabs( double ); }
    25 long double fabs( long double );
    26 float cabs( float _Complex );
    27 // extern "C" { double cabs( double _Complex ); }
    28 long double cabs( long double _Complex );
    2922
    3023float ?%?( float, float );
  • src/libcfa/math.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Tue Apr 19 22:23:08 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 08:52:31 2016
    13 // Update Count     : 75
     12// Last Modified On : Tue May 23 22:52:13 2017
     13// Update Count     : 76
    1414//
    1515
     
    1919#include <complex.h>
    2020} // extern "C"
    21 
    22 float fabs( float x ) { return fabsf( x ); }
    23 long double fabs( long double x ) { return fabsl( x ); }
    24 float cabs( float _Complex x ) { return cabsf( x ); }
    25 long double cabs( long double _Complex x ) { return cabsl( x ); }
    2621
    2722float ?%?( float x, float y ) { return fmodf( x, y ); }
  • src/libcfa/stdlib

    ra8e64c4 r0a208b8  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  9 08:42:44 2017
    13 // Update Count     : 107
     12// Last Modified On : Wed May 24 18:06:27 2017
     13// Update Count     : 115
    1414//
    1515
     
    2828//---------------------------------------
    2929
    30 extern "C" { void * malloc( size_t ); }                                 // use default C routine for void *
    3130forall( dtype T | sized(T) ) T * malloc( void );
    3231forall( dtype T | sized(T) ) T * malloc( char fill );
     
    4241forall( dtype T | sized(T) ) T * memalign( size_t alignment );          // deprecated
    4342forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment );
    44 
    45 extern "C" {
    46 void * memset( void * ptr, int fill, size_t size );
    47 void free( void * ptr );
    48 } // extern "C"
    4943
    5044forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p );
     
    109103double abs( double _Complex );
    110104long double abs( long double _Complex );
    111 forall ( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
     105forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
    112106T abs( T );
    113107
     
    115109
    116110void rand48seed( long int s );
    117 char rand48();
    118 int rand48();
    119 unsigned int rand48();
    120 long int rand48();
    121 unsigned long int rand48();
    122 float rand48();
    123 double rand48();
    124 float _Complex rand48();
    125 double _Complex rand48();
    126 long double _Complex rand48();
     111char rand48( void );
     112int rand48( void );
     113unsigned int rand48( void );
     114long int rand48( void );
     115unsigned long int rand48( void );
     116float rand48( void );
     117double rand48( void );
     118float _Complex rand48( void );
     119double _Complex rand48( void );
     120long double _Complex rand48( void );
    127121
    128122//---------------------------------------
  • src/libcfa/stdlib.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  9 08:43:00 2017
    13 // Update Count     : 191
     12// Last Modified On : Wed May 24 18:13:15 2017
     13// Update Count     : 198
    1414//
    1515
     
    279279
    280280void rand48seed( long int s ) { srand48( s ); }
    281 char rand48() { return mrand48(); }
    282 int rand48() { return mrand48(); }
    283 unsigned int rand48() { return lrand48(); }
    284 long int rand48() { return mrand48(); }
    285 unsigned long int rand48() { return lrand48(); }
    286 float rand48() { return (float)drand48(); }                             // otherwise float uses lrand48
    287 double rand48() { return drand48(); }
    288 float _Complex rand48() { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
    289 double _Complex rand48() { return drand48() + (double _Complex)(drand48() * _Complex_I); }
    290 long double _Complex rand48() { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
     281char rand48( void ) { return mrand48(); }
     282int rand48( void ) { return mrand48(); }
     283unsigned int rand48( void ) { return lrand48(); }
     284long int rand48( void ) { return mrand48(); }
     285unsigned long int rand48( void ) { return lrand48(); }
     286float rand48( void ) { return (float)drand48(); }               // otherwise float uses lrand48
     287double rand48( void ) { return drand48(); }
     288float _Complex rand48( void ) { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
     289double _Complex rand48( void ) { return drand48() + (double _Complex)(drand48() * _Complex_I); }
     290long double _Complex rand48( void) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
    291291
    292292//---------------------------------------
  • src/tests/.expect/64/math.txt

    ra8e64c4 r0a208b8  
    1 fabs: 1 1 1 1.41421 1.41421356237309505 1.41421356237309505
    2 fmod: 1 1 1 1 1 1
    3 remainder: -1 -1 -1
    4 remquo: 7 0.0999999 7 0.1 7 0.0999999999999999999
    5 div: 7 0.0999999 7 0.1 7 0.0999999999999999999
    6 fma: -2 -2 -2
    7 fdim: 2 2 2
    8 nan: nan nan nan
    9 exp: 2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i
    10 exp2: 2 2 2
    11 expm1: 1.71828 1.71828182845905 1.71828182845904524
    12 log: 0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i
    13 log2: 3 3 3
    14 log10: 2 2 2
    15 log1p: 0.693147 0.693147180559945 0.693147180559945309
    16 ilogb: 0 0 0
    17 logb: 3 3 3
    18 sqrt: 1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i
    19 cbrt: 3 3 3
    20 hypot: 1.41421 1.4142135623731 1.41421356237309505
    21 pow: 1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i
    22 sin: 0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i
    23 cos: 0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
    24 tan: 1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
    25 asin: 1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
    26 acos: 0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
    27 atan: 0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
    28 atan2: 0.785398 0.785398163397448 0.78539816339744831 atan: 0.785398 0.785398163397448 0.78539816339744831 sinh: 1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i
    29 cosh: 1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i
    30 tanh: 0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i
    31 acosh: 0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i
    32 asinh: 0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i
    33 atanh: inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i
    34 erf: 0.842701 0.842700792949715 0.842700792949714869
    35 erfc: 0.157299 0.157299207050285 0.157299207050285131
    36 lgamma: 1.79176 1.79175946922805 1.791759469228055
    37 lgamma: 1.79176 1 1.79175946922805 1 1.791759469228055 1
    38 tgamma: 6 6 6
    39 floor: 1 1 1
    40 ceil: 2 2 2
    41 trunc: 3 3 3
    42 rint: 2 2 2
    43 rint: 2 2 2
    44 rint: 2 2 2
    45 lrint: 2 2 2
    46 llrint: 2 2 2
    47 nearbyint: 4 4 4
    48 round: 2 2 2
    49 round: 2 2 2
    50 round: 2 2 2
    51 lround: 2 2 2
    52 llround: 2 2 2
    53 copysign: -1 -1 -1
    54 frexp: 0.5 3 0.5 3 0.5 3
    55 ldexp: 8 8 8
    56 modf: 2 0.3 2 0.3 2 0.3 nextafter: 2 2 2
    57 nexttoward: 2 2 2
    58 scalbn: 16 16 16
    59 scalbln: 16 16 16
     1fmod:1 1 1 1 1 1
     2remainder:-1 -1 -1
     3remquo:7 0.0999999 7 0.1 7 0.0999999999999999999
     4div:7 0.0999999 7 0.1 7 0.0999999999999999999
     5fma:-2 -2 -2
     6fdim:2 2 2
     7nan:nan nan nan
     8exp:2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i
     9exp2:2 2 2
     10expm1:1.71828 1.71828182845905 1.71828182845904524
     11log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i
     12log2:3 3 3
     13log10:2 2 2
     14log1p:0.693147 0.693147180559945 0.693147180559945309
     15ilogb:0 0 0
     16logb:3 3 3
     17sqrt:1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i
     18cbrt:3 3 3
     19hypot:1.41421 1.4142135623731 1.41421356237309505
     20pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i
     21sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i
     22cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
     23tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
     24asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
     25acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
     26atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
     27atan2:0.785398 0.785398163397448 0.78539816339744831 atan:0.785398 0.785398163397448 0.78539816339744831 sinh:1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i
     28cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i
     29tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i
     30acosh:0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i
     31asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i
     32atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i
     33erf:0.842701 0.842700792949715 0.842700792949714869
     34erfc:0.157299 0.157299207050285 0.157299207050285131
     35lgamma:1.79176 1.79175946922805 1.791759469228055
     36lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1
     37tgamma:6 6 6
     38floor:1 1 1
     39ceil:2 2 2
     40trunc:3 3 3
     41rint:2 2 2
     42rint:2 2 2
     43rint:2 2 2
     44lrint:2 2 2
     45llrint:2 2 2
     46nearbyint:4 4 4
     47round:2 2 2
     48round:2 2 2
     49round:2 2 2
     50lround:2 2 2
     51llround:2 2 2
     52copysign:-1 -1 -1
     53frexp:0.5 3 0.5 3 0.5 3
     54ldexp:8 8 8
     55modf:2 0.3 2 0.3 2 0.3 nextafter:2 2 2
     56nexttoward:2 2 2
     57scalbn:16 16 16
     58scalbln:16 16 16
  • src/tests/KRfunctions.c

    ra8e64c4 r0a208b8  
    1 //                               -*- Mode: C -*-
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     
    1110// Created On       : Thu Feb 16 15:23:17 2017
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Thu Feb 16 15:25:52 2017
    14 // Update Count     : 2
     12// Last Modified On : Wed May 24 22:05:00 2017
     13// Update Count     : 3
    1514//
    1615
  • src/tests/complex.c

    ra8e64c4 r0a208b8  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// complex.c --
     8//
     9// Author           : Peter A. Buhr
     10// Created On       : Wed May 24 22:07:31 2017
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed May 24 22:08:01 2017
     13// Update Count     : 1
     14//
     15
    116#include <stdio.h>
    217#include <complex.h>
     
    2035#endif // __CFA
    2136}
     37
     38// Local Variables: //
     39// tab-width: 4 //
     40// compile-command: "cfa complex.c" //
     41// End: //
  • src/tests/gmp.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 22 09:05:09 2017
    13 // Update Count     : 538
     12// Last Modified On : Wed May 24 22:05:38 2017
     13// Update Count     : 540
    1414//
    1515
     
    8888        sout | (int)0 | fact | endl;
    8989        for ( unsigned int i = 1; i <= 40; i += 1 ) {
    90                 fact = fact * i;                                                                // general case
     90                fact *= i;                                                                              // general case
    9191                sout | i | fact | endl;
    9292        } // for
     
    9494
    9595// Local Variables: //
    96 // mode: c //
    9796// tab-width: 4 //
     97// compile-command: "cfa gmp.c -l gmp" //
    9898// End: //
  • src/tests/math.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 13:24:20 2016
    13 // Update Count     : 70
     12// Last Modified On : Wed May 24 13:04:33 2017
     13// Update Count     : 71
    1414//
    1515
     
    2222        long double l;
    2323
    24         sout | "fabs:" | fabs( -1.0F ) | fabs( -1.0D ) | fabs( -1.0L ) | cabs( -1.0F+1.0FI ) | cabs( -1.0D+1.0DI ) | cabs( -1.0DL+1.0LI ) | endl;
    2524        sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ) | endl;
    2625        sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ) | endl;
  • src/tests/numericConstants.c

    ra8e64c4 r0a208b8  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// numericConstants.c --
     8//
     9// Author           : Peter A. Buhr
     10// Created On       : Wed May 24 22:10:36 2017
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed May 24 22:11:36 2017
     13// Update Count     : 2
     14//
     15
    116int main() {
    217        1;                                                      // decimal
     
    4863        0x_ff.ffp0;                                     // hex real
    4964        0x_1.ffff_ffff_p_128_l;
    50 }
     65} // main
     66
     67// Local Variables: //
     68// tab-width: 4 //
     69// compile-command: "cfa minmax.c" //
     70// End: //
  • src/tests/rational.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 15 21:32:22 2017
    13 // Update Count     : 64
     12// Last Modified On : Wed May 17 15:46:35 2017
     13// Update Count     : 65
    1414//
    1515
Note: See TracChangeset for help on using the changeset viewer.