Quartz
所属分类:编程语言基础
开发工具:OCaml
文件大小:0KB
下载次数:0
上传日期:2018-05-03 00:00:09
上 传 者:
sh-1993
说明: Quartz编程语言的官方编译器,
(The official compiler for the Quartz programming language,)
文件列表:
.merlin (21, 2018-05-01)
IDEAS.md (80, 2018-05-01)
LICENSE (35106, 2018-05-01)
Makefile (750, 2018-05-01)
_oasis (548, 2018-05-01)
configure (363, 2018-05-01)
examples/ (0, 2018-05-01)
examples/basic.qrz (350, 2018-05-01)
examples/basic_stmt.qrz (134, 2018-05-01)
examples/exprs.qrz (291, 2018-05-01)
global-synthesis/ (0, 2018-05-01)
global-synthesis/cfsm.ml (17965, 2018-05-01)
global-synthesis/synth.ml (302, 2018-05-01)
global-synthesis/type.txt (89, 2018-05-01)
opam (446, 2018-05-01)
setup.ml (2044, 2018-05-01)
src/ (0, 2018-05-01)
src/ast.ml (6044, 2018-05-01)
src/emit.ml (8888, 2018-05-01)
src/lexer.mll (2096, 2018-05-01)
src/main.ml (1378, 2018-05-01)
src/parser.mly (4626, 2018-05-01)
src/pos.ml (580, 2018-05-01)
src/type.ml (3710, 2018-05-01)
src/typecheck.ml (3651, 2018-05-01)
typing.pl (3811, 2018-05-01)
vm/ (0, 2018-05-01)
vm/IDEAS.md (4777, 2018-05-01)
vm/build.sh (146, 2018-05-01)
vm/src/ (0, 2018-05-01)
vm/src/main.cpp (3114, 2018-05-01)
vm/src/qvm_instrs.cpp (2948, 2018-05-01)
vm/src/qvm_instrs.h (1726, 2018-05-01)
vm/src/qvm_interpreter.cpp (16244, 2018-05-01)
vm/src/qvm_interpreter.h (276, 2018-05-01)
vm/src/qvm_types.cpp (5395, 2018-05-01)
vm/src/qvm_types.h (4081, 2018-05-01)
... ...
# Quartz
Quartz is a statically typed, concurrent programming language for the BEAM VM based on the actor model with a sleek, Ruby-based syntax and support for functional and object-oriented programming.
## Features
* Familiar Ruby-like syntax
* First-class concurrency primitives
* Actor model message passing à la Erlang
* Static typing for messages based on multiparty session types
* Duality checking
* Structural subtyping
* First-class functions
## Roadmap
- [x] AST
- [x] Pretty Printing
- [x] Core Compiler
- [X] Lexer
- [X] Parser
- [X] FFI
- [ ] Tuples
- [ ] Instance Variables (Mutability)
- [ ] Comparison, arithmetic operators
- [ ] Module Compiler
- [X] Type.t
- [ ] Type parser
- [ ] Type Inference/Type Checking
- [ ] Pattern Matching
- [ ] Syntax Cleanup
## Examples
```
# Server: forall c < ...!{Start ~> ...?{Ok ~> Eps, Err(String) ~> Eps}}.
# rec self.
# [client : c]
# ?client{Start ~> !client{Ok ~> self, Err(String) ~> self}}
session Server
on Start from sender
case File.open("file.txt")
when Success(f)
sender!Ok
File.read_into(f, |x| sender!Value(x) end)
else
sender!Err("Could not open file.txt!")
end
end
loop
end
# Client: (target : Server) ->
# !target{Start ~> ?target{Ok ~> Eps, Err(String) ~> Eps}}
session Client (target : Server)
target!Start
on Ok from target
on Value(status) from target
print(status)
end
or Err(e)
print("Server-side error when opening file: " ++ e)
end
close # Closes by default, but can be provided explicitly. Can also use `loop`.
end
fun main
let server = spawn Server
spawn Client(server)
end
```
The above example compiles into the following Erlang output:
```erlang
-export([server/1, client/1, main/1]).
server(unit) ->
receive {start, Sender} ->
io:format("Starting~n", []),
case file:open("file.txt") of
{success, F} ->
Sender!{ok, self()},
file:read_into(F)(fun(Value) -> Sender!{{value, Value}, self()} end);
_ ->
Sender!{err, self()}
end
end.
client(Target) ->
io:format("Starting~n", []),
Target!{start, self()},
receive
{ok, Sender} ->
receive {{value, Status}, Sender} ->
print(Status),
close(unit)
end;
{err, Sender} ->
print("Server-side error when opening file"),
close(unit)
end.
main(_) ->
Server = spawn(ex, server, [unit]),
spawn(ex, client, [Server]).
```
近期下载者:
相关文件:
收藏者: