|
Project Information
Featured
|
PythoidC is the C language like the Python, by the Python and for the Python -- CHEN Guang,MD Department of Dermatology, No.1 Hospital of China Medical University ADVANTAGES: 1. Braceless (no {}), semicolonless (no ; at line ends), white space sensitive (indent/unindent region to express code block) 2. Auto-completion: no need to remember all the functions, constants, data structures and their corresponding H file. PythoidC automatically parses all the H files, and thus realized step by step auto-completion (like c.stdio.printf) 3. Introspectable: c.stdio.printf followed by an ENTER key tells the prototype; c.search('printf'), tells its prototype and the corresponding H file; c.search('printf',0) tells the whole printf family; dir(c.stdio) lists all items/prototypes in stdio.h; c.context('c.stdio.printf',2) tells the context items of "printf", including annotations. 4. No DOS window (console), results and error messages are displayed in IDE. Compiling is optional, direct running is possible. 5. Take PythonWin as IDE, coexist with Python code in the same file, most convenient for C-Python mixed programming. 6. Automatically generates standard C source code, which corresponds with PythoidC source code line by line. There is no special requirement for compiling in VC++, BC++, DevC++, gcc. Interactive PythoidC introspection: >>> import c >>> c.GetHfiles(topPath='D:/PythoidC/tcc/include/') >>> c.h.stdio stdio.h >>> c.h.stdio.beIncluded() >>> c.stdio.printf int printf (const char*, ...); >>> c.stdio.printf.context(2) /* * Formatted Output */ int fprintf (FILE*, const char*, ...); int printf (const char*, ...); int sprintf (char*, const char*, ...); int _snprintf (char*, size_t, const char*, ...); >>> PythoidC code example: Fibonacci Numbers by recursion c.h.stdio.beIncluded()
c.h.stdlib.beIncluded()
'''Annotation is free!'''
int fib(int n):
if (n<=2):
return 1
else:
return fib(n-1) + fib(n-2)
int main(int argc, char **argv):
int n //C style annotation
n=c.stdlib.atoi(argv[1])
c.stdio.printf('fibonacci(%d)=%d\n', n, fib(n))C code generated by PythoidC: Fibonacci Numbers by recursion #include <stdio.h>
#include <stdlib.h>
/*Annotation is free!*/
int fib(int n){
if (n<=2){
return 1;}
else{
return fib(n-1) + fib(n-2);}}
int main(int argc, char **argv){
int n ;//C style annotation
n=atoi(argv[1]);
printf("fibonacci(%d)=%d\n", n, fib(n));
}
|