Xv6 with picoc & Linkage editor
v1.0
The project delineate mutual cohesion between c library, linkage editor ( linker), interpreter and operating system by porting the same on xv6 kernel
|
00001 #include <stdio.h> 00002 #include <math.h> 00003 00004 // variables 00005 float a = 12.34 + 56.78; 00006 printf("%f\n", a); 00007 00008 // infix operators 00009 printf("%f\n", 12.34 + 56.78); 00010 printf("%f\n", 12.34 - 56.78); 00011 printf("%f\n", 12.34 * 56.78); 00012 printf("%f\n", 12.34 / 56.78); 00013 00014 // comparison operators 00015 printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78); 00016 printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34); 00017 printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34); 00018 00019 // assignment operators 00020 a = 12.34; 00021 a += 56.78; 00022 printf("%f\n", a); 00023 00024 a = 12.34; 00025 a -= 56.78; 00026 printf("%f\n", a); 00027 00028 a = 12.34; 00029 a *= 56.78; 00030 printf("%f\n", a); 00031 00032 a = 12.34; 00033 a /= 56.78; 00034 printf("%f\n", a); 00035 00036 // prefix operators 00037 printf("%f\n", +12.34); 00038 printf("%f\n", -12.34); 00039 00040 // type coercion 00041 a = 2; 00042 printf("%f\n", a); 00043 printf("%f\n", sin(2)); 00044 00045 void main() {}