2007년 08월 31일
Language sketch
스케치해본 ICL 소스.
2002.4
class Point
{
Int _x;
Int _y;
def _constructor (Int x = 0, Int y = 0)
{
self._x = x;
self._y = y;
}
def _destructor
{
}
def Int x
{
미완성.
역시 그때와 많이 바뀌었구나.
이건 2001년 3월 4일 일요일, 오전 1:16:58에 작성한 것.
import sys;
object counter_t {
[private]
int count;
[public]
proc __init__ () {
count = 0;
}
proc __close__ () {
}
proc inc_val() {
if count < __MAX_int {
inc count;
}
}
proc query_val() {
return count;
}
}
counter_t counter;
proc main() {
sys.exit(sys.good);
}
Python과 비슷해졌다.
2001년 3월 31일 토요일, 오후 2:27:20 버전:
@module helloworld;
@from system import sys;
@from vendor.Microsoft import Direct3D D3D, DirectX DX;
@def MAX_STACK 1000;
proc devant(int_t d_v) :
D3D.MoveRel(d_v * 100, d_v / 100);
DX.InitAllRendering();
sys.write(stdout, "%d\n", d_v);
fin
object stack:
(safe)int_t[1..MAX_STACK] stack ;
int_t stack_p;
proc __init__:
.stack_p = 0;
fin
proc push (int_t d_v) :
.stack_p = .stack_p + 1;
.stack[.stack_p] = d_v;
fin
func int_t pop :
pop = .stack[.stack_p];
.stack_p = .stack_p - 1;
fin
fin (object stack);
proc do_helloworld :
sys.write(sys.stdout, "Hello, world\n");
fin
proc __init__ :
do_something();
self.devant();
do_helloworld();
fin
2002.1.31에 작성한 PICL 스케치
PICL Specification
Picl Means 'Pre-Icl': A Primitive version of 'Interpretable and Compilable Language'.
I decided to make it for system programming purpose, instead of C.
Syntax:
@module;
: Declares that this file is a module.
@application;
: Declares that this file is an application.
@use <16 or 32>;
: Declares bit depth of an integer.
@import;
: Import external module. (dynamic binding)
@staticimport;
: Import external module. (static binding)
proc( ) { }
: Procedure returns no value.
func( ) { }
: Function returns a vaule.
filter () ( ) { }
: Filter returns multiple values. There is no call-by-reference in PICL.
In statements:
int a;
: Declare an auto integer variable whose name is 'a'.
native { ... }
: Use IA32 Assembly code.
if{ } [elif { } ] [else { }]
: if.
for= .. [step ] { }
: for.:
: label.
goto;
: goto.
while{ }
: while.
do {} until ;
: do ~ until.
do {} while ;
: do ~ while.
case{
: ...
:
...
[else] ...
}
: case.
Array
int a[3,4];
a[1,1] = 3;
아래아한글 문서파일로 있던것 여기로 옮기고 지움.
2000년 8월 7일 월요일, 오전 6:59:40 a.tl
/* A.TL: TL Testing Program */
#include "startup.h";
#include "startup.h";
#include "startup.h";
#include "startup.h";
#define void proc;
a:
b:
gogogo:
void proc_1(int param_1, int param_2)
int i;
{
if 3 {
goto a;
}
` else {
goto b;
}`
` i = 3;
return;`
}
`gogogo:`
func int func_1(int param_1, int param_2)
int i;
{
while 3 {
goto gogogo;
break;
}
for (goto a; 3; goto b) {
goto gogogo;
break;
}
` i = param_1 + param_2 * 3;
return i;`
}
void main(int argc, char* param)
int i;
{
` proc_1(0, 0);
i = func_1(0, 0);`
}
2002년 11월 17일 일요일, 오후 3:14:38 synt.txt
for i in lvalue to rvalue
{
for j in 1..100
{
for (i = 0; i < 100; i++)
{
for item in f
{
for
for i in (1 to 100)
{
for j in (0 until 100)
{
for i
g: list of integer;
l: pointer of integer;
g = 1 to 100;
l points g[0];
if @l == 3
{
l points next;
@l = 4;
}
}
import cgi;
cgi.MakeHTTPRequest('kr.yahoo.com:80') whenerror 'Not able to connect';
println 'We have to return to thepch.' to stdout;
print "Content-type: text/html\n\nhey!"
to HttpRequestResponser;
import sys;
sys.exit(0);
}
# by | 2007/08/31 02:17 | 나중에 옮길 글 | 트랙백 | 덧글(0)





☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]