Added Zephir language

This commit is contained in:
Gusakov Nikita
2014-04-15 16:24:30 +04:00
parent f39456ee47
commit 0240b76cc3
4 changed files with 1309 additions and 8 deletions

53
samples/Zephir/Cblock.zep Normal file
View File

@@ -0,0 +1,53 @@
/**
* CBLOCK tests
* asfas
*/
%{
// top statement before namespace, add to after headers
#define MAX_FACTOR 40
}%
namespace Test;
%{
// top statement before class, add to after headers
// test include .h
#include "kernel/require.h"
}%
%{
// c implement fibonacci
static long fibonacci(long n) {
if (n < 2) return n;
else return fibonacci(n - 2) + fibonacci(n - 1);
}
}%
class Cblock
{
public function testCblock1()
{
int a = 0;
%{
a = MAX_FACTOR;
}%
return a;
}
public function testCblock2()
{
long a = 0;
%{
a = fibonacci(MAX_FACTOR);
}%
return a;
}
}