deeplang-org / deeplang Goto Github PK
View Code? Open in Web Editor NEWDeeplang is a new language for IoT device programming.
Home Page: http://www.deeplang.org
License: BSD 3-Clause "New" or "Revised" License
Deeplang is a new language for IoT device programming.
Home Page: http://www.deeplang.org
License: BSD 3-Clause "New" or "Revised" License
将静态结构化类型\代数数据类型-ADT\委托\鸭子类型的相关特性添加到readme中.
deepvm的内存管理设计
相比 let arr: [i32;10] = [];
,这样 let arr: i32[10] = [];
是否更易读呢?另外,请问 i32;10
用分号分隔而不是逗号有何特别原因吗?
Describe the bug
int deep_wasm_eval (uint8 * wasm_buf, uint32 wasm_size);
call deep_wasm_eval error.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
finish and return 0;
Errors/Logs
/Users/yangwenzhang/workspace/deeplang/src/vm/deep_wasm_main.c:89, deep_wasm_eval(), [wasm_buf]: length = 128 (0x80)
0x7ff73ae111f0 00 61 73 6D 01 00 00 00 - 01 0C 03 60 00 00 60 02 | .asm.......`..`.
0x7ff73ae11200 7F 7F 00 60 00 00 03 04 - 03 00 01 00 07 14 03 03 | ...`............
0x7ff73ae11210 66 6F 6F 00 00 03 62 61 - 72 00 01 04 6D 61 69 6E | foo...bar...main
0x7ff73ae11220 00 02 0A 4C 03 11 02 01 - 7F 01 7F 41 01 21 00 41 | ...L.......A.!.A
0x7ff73ae11230 0A 20 00 6A 21 01 0B 21 - 05 01 7F 01 7F 01 7F 01 | . .j!..!........
0x7ff73ae11240 7F 01 7F 41 02 21 02 41 - 05 21 03 20 03 20 02 20 | ...A.!.A.!. . .
0x7ff73ae11250 01 20 00 6A 6A 6A 21 04 - 0B 16 02 01 7F 01 7F 41 | . .jjj!........A
0x7ff73ae11260 E3 00 21 00 41 E4 00 21 - 01 20 00 20 01 10 01 0B | ..!.A..!. . ....
/Users/yangwenzhang/workspace/deeplang/src/vm/wasm_memory.c:111, wasm_runtime_malloc(), wasm_runtime_malloc failed: memory hasn't been initialized.
WASM module load failed: allocate memory failed.
Additional context
nop
interface I {
fun f()
// var f: ()->unit
}
class Foo {
fun f() {
println("")
}
}
class Bar implements I {
fun f()
}
fun useI(i: I) {
i.f()
}
useI( new Foo() )
struct String {
fun f() {}
}
enum Color {
fun f() {}
}
extension
在原来类型的基础上,添加新的函数。
class Foo {
}
extension Foo {
fun run() {
this.xxxx
}
}
/*
fun Foo_run(this: Foo) {
}
*/
extension Foo {
fun f() {}
}
fun main() {
let x = new Foo()
x.run()
useI( new Foo() )
}
extension Foo implements I {
fun f() {}
}
extension String {
fun reverse() -> String {
.....
}
}
"123".reverse()
将一个子字段field的成员(field,method)都委托到当前层级。
class A {
let x: Int
fun hello() {
......
}
fun f() {}
}
// class B : A {}
class B {
as let a: A
}
let b = new B()
b.x // b.a.x
b.hello() // b.a.hello()
b.f()
useI( b )
// 如果委托的字段,有重现同名的成员(field,method),这个同名的成员就不会被委托。
class C {
fun f() {}
}
class B {
as let a: A
as let c: C
fun f() {
c.f()
}
}
struct D {
fun f() {}
}
struct E {
as let d: D
}
type A struct {
v int
}
type B struct {
A
}
"print" in frontend ,"puts" in backend.
"puts" is supported in wasm vm( backend).
print
featureprint
function// now
if expr {
expr
} else {
expr
}
expr ? expr : expr
// new
func name() {
}
keyword name() {
}
=>
keyword () {
}
<=>
if () {}
for () {}
// c
if (expr) expr
for (expr) expr
fun (params) expr
keyword () (expr|'{' expr* '}')
// if
if (expr) expr else expr // expr ? expr : expr
if (expr) { expr } else { expr }
// for
for (expr) expr
for (expr) { expr }
// while
while () expr
// fun
fun (params) expr // (parmas) => expr
fun (params) { expr } // (parmas) => { expr }
// change
if (else if) else // else if
if expr {} else if expr {} else {}
if (expr) expr else ifexpr // == 'if (expr) {} else {}'' // 不需要定义 else if
// fun decl
let f = fun (params) f() // 因为是 let,所以可以优化成函数声明,可以递归
==>
fun f(params) { return f() } // 等价于上面,可以递归
let mut f2 = fun (params) expr // 不能递归 f2
// 变量定义 | 类型定义
let fn = fun(arr:[int]) for(i in arr) if (i % 2 == 0 ) print(i)
let main = fun() expr
label
and assignee
accordingly.- [ ] this is a subtask
- [x] this is a completed subtask
KOKA
struct A {
v1 : string
v2 : int
// and
}
enum B {
v1
v2
// or
}
let a : A = A{"123", 2}
let b : B = B.v1
enum C {
v1(string)
v2(int)
}
let c : C = C.v1("321")
enum Option<T> {
None
Some(T)
}
class Foo{ func f(){} }
var x : Foo = new Foo()
// x = Foo
var y : Option<Foo> = new Foo()
// y = Option.None
// y = Option.Some
var z : Foo? = new Foo()
z?.f()?.g()?.h()
let o : Foo = z ?? new Foo() // orElse(new Foo())
--->
match z {
case Some(let v) => v.f()
case None => break
}
enum Result<T> {
Failure(Error)
Success(T)
}
func DoSomething() -> Result<Foo> {...}
let a = DoSomething()
match a {
case Success(let v) => v.f()
case Failure(let log) => log.Print()
}
// new syntax
type id<T> {
item
item
}
type Option<T> {
none
some(T)
}
type Person {
person(String, Int)
}
type Person((String, String), Int)
type Person(name: String, age: Int)
-->
struct Person {
name: String
age: Int
}
type Body {
v1
v2
}
type id {
item(label: T1, label2: T2)
item2(label2: T3)
}
class Foo {
let a : Int = 1
let mut b = f // ???
func f(){} // this (Foo, ()) -> () => () -> ()
}
// KOKA
func NewFoo() -> Foo {...}
type Foo (
a : Int = 1,
b : () -> () = () => ()
) {
func f(){}
}
type f_Interface {
func f(){}
}
type id [
item(label: T1, label2: T2),
item2(label2: T3)
] {
func f(){}
}
Add the analysis into codereview.md
文档里面有char这个基本类型,一般char用来表示一个字符,但是char只有16位,是不足以完整表示一个字符的,一个u32/i32 才能完整存储一个字符。是否去掉char类型,直接用i32。或者保留char, 像rust一样,char改成32位。
最早的unicode版本收录的字符少,16位就够了,后面unicode已经有100万+字符了,16位完全不够。这个时候,用16位的char就完全不够了。改成32位是一个比较好的选择
Target is board smartloong
cpu : loongson 1C300 , 240Mhz
RAM : 64MB
url : http://loongson.cn/product/cpu/1/Loongson1C.html
学习使用IoT开发板ESP32,包括编译、烧录、测试工具。
学习链接:https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/
如何与C语言交互?打算写个AWTK的绑定。
wasmvm代码合入dev分支
print
ready, #6HI3861 is a wifi chip for smarthome.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.