剑神一笑

我的世界,不止有0和1,还有你...

导航

<2012年5月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

统计

公告

文章分类

档案

随笔分类

相册

程序员朋友

随便逛逛

登录

2005年4月21日

严打开始

编译器语法分析,语义分析,属性计算部分快完成了 下面的代码成功分析:
 class Shape {
    //测试成员,无意义
    private int[][] arr = new arr[10][10];
    public const int max = 250, min = 0;
    public Shape s;
    public void draw() {}
    public string toString() {
        return "Shape";
    }
    public void main(String[] args) {
        Shape[] lines = new Shape[10];
        int i;
        for (i = 0; i < lines.length; i++) {
            lines[i] = new Line(Random.int(), Random.int());
            lines[i].draw();
        }
    }
}

class Line extends Shape {
    private int x, y;
    public Line(int x, int y) {
        this.x = x; this.y = y;
    }
    public void draw() {
        Sys.println(this.toString());
    }
    public string toString() {
        return "Line:" + String(x) + " " + String(y);
    }
}
语法类似JAVA,不支持的东西有 接口,静态成员(有时间的话再加上),需要改进的地方, 错误提示系统

PS:今天班主任发飚了,我们班出勤率全院最低,明天开始严打,一天不上课通报学院,看来不能逃课写程序了 (-_-)

21:08 | 评论 (8)


请不要发表可能给我们带来伤害的政治言论,谢谢配合