source: src/examples/prolog.c @ 52ac3b4

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 52ac3b4 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 686 bytes
Line 
1// "./cfa prolog.c"
2
3extern "C" { extern int printf( const char *fmt, ... ); }
4
5void printResult( int x ) { printf( "int\n" ); }
6void printResult( double x ) { printf( "double\n" ); }
7void printResult( char * x ) { printf( "char*\n" ); }
8
9void is_arithmetic( int x ) {}
10void is_arithmetic( double x ) {}
11
12void is_integer( int x ) {}
13
14context ArithmeticType( type T ) {
15    void is_arithmetic( T );
16};
17
18context IntegralType( type T | ArithmeticType( T ) ) {
19    void is_integer( T );
20};
21
22forall( type T | IntegralType( T ) | { void printResult( T ); } )
23void hornclause( T param ) {
24    printResult( param );
25}
26
27int main() {
28    int x;
29    double x;
30    char * x;
31    hornclause( x );
32}
Note: See TracBrowser for help on using the repository browser.