Changeset 58b5d03
- Timestamp:
- Jun 14, 2016, 11:51:31 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 7b21d99
- Parents:
- 905cf4b
- Location:
- src/examples
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/ctxts.c
r905cf4b r58b5d03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 18:10:21201613 // Update Count : 312 // Last Modified On : Fri Jun 10 15:18:33 2016 13 // Update Count : 4 14 14 // 15 15 16 trait has_f( type T ) {16 trait has_f( otype T ) { 17 17 T f( T ); 18 18 }; 19 19 20 trait has_g( type U | has_f( U ) ) {20 trait has_g( otype U | has_f( U ) ) { 21 21 U g( U ); 22 22 }; 23 23 24 forall( type V | has_g( V ) ) void h( V );24 forall( otype V | has_g( V ) ) void h( V ); 25 25 26 26 // Local Variables: // -
src/examples/esskaykay.c
r905cf4b r58b5d03 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:11:45 201513 // Update Count : 212 // Last Modified On : Fri Jun 10 15:25:12 2016 13 // Update Count : 4 14 14 // 15 15 16 // forall ( type A, type B,type C) C ess (C (*f) (A,B), B (*g) (A), A x) { return f(x,g(x)); }17 forall ( type A, type B,type C) C ess (C (*(*f)(A))(B), B (*g)(A), A x) { return f(x)(g(x)); }16 // forall (otype A, otype B, otype C) C ess (C (*f) (A,B), B (*g) (A), A x) { return f(x,g(x)); } 17 forall (otype A, otype B, otype C) C ess (C (*(*f)(A))(B), B (*g)(A), A x) { return f(x)(g(x)); } 18 18 19 // forall ( type A,type B) A kay (A a, B b) { return a; }20 forall ( type A,type B) A (*kay(A a))(B b);19 // forall (otype A, otype B) A kay (A a, B b) { return a; } 20 forall (otype A, otype B) A (*kay(A a))(B b); 21 21 22 22 // Now is the following function well-typed, or not? 23 23 24 forall ( type A) A esskaykay (A x) { ess (kay, kay, x); }24 forall (otype A) A esskaykay (A x) { ess (kay, kay, x); } 25 25 26 26 // Local Variables: // -
src/examples/io.c
r905cf4b r58b5d03 11 11 // Created On : Wed Mar 2 16:56:02 2016 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Thu May 26 10:06:00201614 // Update Count : 2813 // Last Modified On : Wed Jun 8 22:52:04 2016 14 // Update Count : 30 15 15 // 16 16 … … 34 34 long double _Complex ldc; 35 35 char s1[10], s2[10]; 36 37 int x = 3, y = 5, z = 7; 38 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl; 39 sout | 1 | 2 | 3 | endl; 40 sout | '1' | '2' | '3' | endl; 41 sout | 1 | "" | 2 | "" | 3 | endl; 42 sout | endl; 36 43 37 44 ifstream in; // create / open file
Note: See TracChangeset
for help on using the changeset viewer.