ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
|
Last change
on this file since c8ffe20b was a0d9f94, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago |
|
add compiler flag to driver, update examples, fix unnamed bit fields
|
-
Property mode
set to
100644
|
|
File size:
686 bytes
|
| Line | |
|---|
| 1 | // "./cfa prolog.c"
|
|---|
| 2 |
|
|---|
| 3 | extern "C" { extern int printf( const char *fmt, ... ); }
|
|---|
| 4 |
|
|---|
| 5 | void printResult( int x ) { printf( "int\n" ); }
|
|---|
| 6 | void printResult( double x ) { printf( "double\n" ); }
|
|---|
| 7 | void printResult( char * x ) { printf( "char*\n" ); }
|
|---|
| 8 |
|
|---|
| 9 | void is_arithmetic( int x ) {}
|
|---|
| 10 | void is_arithmetic( double x ) {}
|
|---|
| 11 |
|
|---|
| 12 | void is_integer( int x ) {}
|
|---|
| 13 |
|
|---|
| 14 | context ArithmeticType( type T ) {
|
|---|
| 15 | void is_arithmetic( T );
|
|---|
| 16 | };
|
|---|
| 17 |
|
|---|
| 18 | context IntegralType( type T | ArithmeticType( T ) ) {
|
|---|
| 19 | void is_integer( T );
|
|---|
| 20 | };
|
|---|
| 21 |
|
|---|
| 22 | forall( type T | IntegralType( T ) | { void printResult( T ); } )
|
|---|
| 23 | void hornclause( T param ) {
|
|---|
| 24 | printResult( param );
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | int main() {
|
|---|
| 28 | int x;
|
|---|
| 29 | double x;
|
|---|
| 30 | char * x;
|
|---|
| 31 | hornclause( x );
|
|---|
| 32 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.