-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DT:一种兼容手写的programming notation #1
Comments
举例: 例1/typescript class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() { return "Hello, " + this.greeting;
}}
let greeter = new Greeter("world"); let button = document.createElement('button');
button.textContent = "Say Hello";
button.onclick = function() {
alert(greeter.greet());
}
document.body.appendChild(button); DT/例1:
|
所有组合符号,均可重定义,比如用竖杠替代双斜杠。 todo:完善/结构语法定义 列表类型 以及 进程oop与flow based兼容的问题 |
DT与CPN的区别:DT使用了符号组合,DTC尽可能减少符号集,DTM则尽可能多的使用单体符号。而CPN则是更通用的方案,比如字符串沿用了现在主流的引号。CPN和DTC比较接近,但对符号数量的控制是次要的,主要是为了便于传播。DTC控制符号数量虽然也有降低学习成本的考虑,但实际上缩减过于复杂,反而会提高学习成本 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
前文:program-in-chinese/overview#94
缘起:很早以前就有想过实现一套适合手写的编程法则,碰巧这次坐地铁的时候想到了这个方案
设计:主要用到四个符号:1空格、2斜杠、3减号、4等号;注释还用到了6井号和7百分号
符号:类似APL,有多种符号组合
顺序:A B / C // D -- E 的顺序是 C(A(B)), D(A(B)), E。
即空格时从右往左,斜杠时从左往右,两横杠则连行断句
区块:单行无区块,用
=
;多行则以- ... =
为块函数:最小逻辑抽象单元,类似erlang的function
结构:函数、c的struct和oop里面的class的综合体
过程:类似pascal里面的procedure,直接修改参数
类:实际上类似java的interface,rust的trait,erlang的behavior
对象:实际上类似erlang的进程,基于actor/协程
类型:可以是结构,也可以是类
类型注解:
a-i32
等价于java里面的int a
和a:int
留白:类似python的white space(但没有强制缩进),只检测数量的有或无/多与少
字符串:默认用减号括起;为了兼容,也可以用双引号
注释:单行用
#
井号空格,多行用%[空格] ... %#
解析:
函数与erlang function的区别:除了函数名,参数目,还要看返回值的目数和类型
重载:所有组合符号,均可重定义,比如用竖杠替代双斜杠。
todo:完善/结构语法定义 列表类型 以及 进程oop与flow based兼容的问题
The text was updated successfully, but these errors were encountered: