cpy-scripting-language - Cpy provides you a way to write Python codes in C syntax! - Google Project Hosting

cpy-scripting-language - Cpy provides you a way to write Python codes in C syntax! - Google Project Hosting

Members
Links

Cpy - A C-like scripting language

Cpy is the real general purposed dynamic c-like syntax scripting language in the 21st century.

Cpy provides you a way to write Python codes in C syntax!

Download & Install

Hello World!

// file: hello.cpy
printf
("Hello World!\n");

$ cpy hello
.cpy
Hello World!
$

Reading from stdin

// file: stdin.cpy
print "input 'q' to quit:";

while(true){
        printf
("> ");
        line
= stdin.readline();
        line
= line.strip().lower();
       
if(line == 'q'){
               
print "bye.";
               
break;
       
}else{
               
print 'your input:', repr(line);
       
}
}

classes and functions

class A{
       
public a = 0;
       
public static s = 1;
       
       
function init(a){
               
this.a = a;
               
print 'A init', a;
       
}

       
function f(a, b=1){
               
return a + b;
       
}
}

print A.s; // 1
a
= new A(1); // A init 1
print a.f(1, 2); // 3

Reusing Python codes

import time; // Python's built-in time module
time
.sleep(1);

Relax and enjoy!

你可能感兴趣的:(language)