Giter Site home page Giter Site logo

hihaheho / desk Goto Github PK

View Code? Open in Web Editor NEW
109.0 3.0 10.0 1.75 MB

๐Ÿ”ฎ The application platform for your cyberpunk desk

Home Page: https://desk-x.com

License: Other

Rust 99.68% Shell 0.27% HTML 0.05%
high-code algebraic-effects functional-programming statically-typed visual-programming

desk's Introduction

Desk

๐Ÿ”ฎ The application platform for your cyberpunk desk

Demo MIT/Apache 2.0 GitHub Sponsors GitHub Repo stars

๐ŸงŠ Project Status: FROZEN ๐ŸงŠ

This project is currently on hold. We may consider resuming development in the near future if there's continued interest or demand. For updates on our ongoing projects, please check our Discord or X.

Discord

Twitter Follow

No Release!

Status: All releases are behind the previous schedule for several reasons, so I updated it below.

Reasons:

  • I'm building query-flow for deskc and dworkspace.
  • I plan to discard the current mirgen and design a new MIR intervening between Desk-lang and low-level IR to generate a GC-less binary, which is fast as Rust in theory (in my mind).
  • I've switched to Ubuntu Desktop from M1 Macbook Pro mainly for financial reasons. As a subsequence of it, I can utilize the mold linker.
  • I've returned to Neovim after several years of a temporary stay in the VSCode.
  • With the lowest priority, I have about three my own projects now to improve IDE experience with the Neovim ecosystem.
  • I've built a Keyball39, a split keyboard placing a injection-molded trackball slot in the really ergonomic position.
  • I'm going to completely re-design the Desk-lang.

Pre-release (by the end of 2025)

Pre-release includes:

  • incremental Desk-lang compiler
  • DeskVM with an official scheduler
  • a file system for Desk-lang
  • Desk-lang visual editor
  • A web demo like Rust Playground for Desk-lang

The first release (by the end of 2030)

The first release includes:

  • MVP of Desk Craft, a game engine
  • a platformer game demo
  • a space to publish created games
  • real-time collaboration on Web
  • paid plans for Desk X (official hosting)

See the draft of the first release

Goals and Philosophy

๐ŸŽฏ Blur the line between living and coding ๐ŸŽฏ Make every software programmable

  • ๐ŸŽฎ Intuitive like games
  • ๐Ÿฅผ Pragmatic like professional tools
  • ๐Ÿ—บ๏ธ๏ธ Versatile like spreadsheets
  • ๐Ÿ’— Accessible to everyone
  • ๐Ÿ›น Minimalist design

Why Desk?

Desk apps are inherently:

  • ๐ŸŽผ code-oriented like data-oriented
  • ๐Ÿ”’ statically-typed (data and UI)
  • ๐Ÿค– programmable (extensible by code)
  • ๐Ÿงฒ interoperable with other Desk apps
  • ๐Ÿ“ฑ running on everywhere (web, desktop, mobile)

How does Desk work?

Desk is consist of:

  • Desk Programming Language and Desk Compiler (deskc)
  • Desk Workspace System (dworkspace)
  • DeskVM (deskvm)
  • Desk-plugins (dplugins)

Desk Programming Language (Desk-lang)

Desk-lang is a programming language that has:

  • minimalistic syntax and semantics
  • type system with inference
  • algebraic effects
  • content-addressable by type and UUID
  • incremental compilation

Most of the data and programs on Desk apps are finally evaluated as a snippet of Desk-lang.

Desk Compiler (deskc)

Desk compiler is an incremental compiler for Desk-lang.

Crates

Desk-workspace (dworkspace)

Desk-workspace is a platform-agnostic environment for editing Desk-lang.

Desk-workspace provides these features:

  • file system for Desk-lang
  • permission management system
  • realtime collaboration support

Crates

DeskVM (deskvm)

DeskVM is a runtime for Desk-lang influenced by Erlang VM.

Features

  • platform-agnostic
  • capable of running many programs as a d-process
  • type-driven message passing and pub/sub
  • interpreter-agnostic: DeskVM can run anything as a d-process
  • preemptive scheduling
  • custom scheduler support

Crates

Desk-plugins (dplugins)

There are many Desk-plugins. Each Desk-plugin implements a single feature as a Bevy Plugin.

  • ๐Ÿšง Desk Craft for game development
  • ๐Ÿšง Desk Brain for productivity
  • ๐Ÿšง Desk Verse for communication
  • ๐Ÿšง Desk Robot for automation
  • ๐Ÿšง Desk Board for BI
  • ๐Ÿšง Desk Calendar for scheduling
  • ๐Ÿšง Desk Pages for hosting

๐Ÿšง not yet implemented

Is it any good?

Yes.

Resources

Join our community

๐Ÿ‘‰ Discord

๐Ÿ‘‰ Twitter Follow

๐Ÿ‘‰ Q&A Have a question?

๐Ÿ‘‰ GitHub Discussions

๐Ÿ‘‰ GitHub Repo stars

desk's People

Contributors

dependabot[bot] avatar jsinger67 avatar renovate[bot] avatar ryo33 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

desk's Issues

`ref` type and `mut` type

'ref type is something like a Arc<T> and 'mut type is something like a Arc<Mutex<T>>.

Syntax

<'ref 'nat> 'ref 1
$ <'mut 'nat> 'mut 1;
// update the value
'mutate & 'mut 'nat & \ 'nat -> 'nat

Consistent NodeID to leverage incremental compilation

Background

  • deskc does incremental compilation for Desk-lang code.
  • dworkspace emits ASTs with inconsistent NodeId in most cases.

Problem

In most cases, full compilation occurs because NodeIds are changed.

Solution

  • Use moka for persistent generated NodeIds.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
Cargo.toml
  • parking_lot 0.12
  • thiserror 1.0
  • uuid 1.3
  • bevy 0.10
  • egui 0.22
  • bevy_math 0.10
  • bevy_ecs 0.10
  • once_cell 1.18
  • maybe-owned 0.3.4
  • egui_cable 0.5
  • ron 0.8
crates/adapters/dworkspace-in-memory/Cargo.toml
crates/apps/desk-x/Cargo.toml
  • bevy-inspector-egui 0.18
  • console_error_panic_hook 0.1
  • web-sys 0.3
crates/components/desk-command/Cargo.toml
crates/components/desk-physics/Cargo.toml
crates/components/desk-plugin/Cargo.toml
crates/components/desk-theme/Cargo.toml
  • serde 1.0
crates/components/desk-window/Cargo.toml
crates/components/deskc-ast/Cargo.toml
  • downcast-rs 1.2
crates/components/deskc-errors/Cargo.toml
crates/components/deskc-hir/Cargo.toml
crates/components/deskc-ids/Cargo.toml
  • uuid 1.3
  • serde 1.0
crates/components/deskc-mir/Cargo.toml
  • serde 1.0
crates/components/deskc-type/Cargo.toml
  • serde 1.0
crates/components/deskvm-dprocess/Cargo.toml
  • anyhow 1.0
  • uuid 1.3
  • mry 0.2.6
  • serde 1.0
crates/components/dson/Cargo.toml
  • serde 1.0
crates/components/dworkspace-codebase/Cargo.toml
crates/libs/deskc-macros/Cargo.toml
  • quote 1.0
  • proc-macro2 1.0
crates/libs/serde-dson/Cargo.toml
  • serde 1.0
  • serde 1.0
crates/plugins/desk-editor/Cargo.toml
crates/plugins/desk-egui/Cargo.toml
  • bevy_egui 0.20
crates/plugins/desk-playground/Cargo.toml
crates/plugins/desk-rapier2d/Cargo.toml
  • bevy_rapier2d 0.21
crates/plugins/desk-terminal/Cargo.toml
crates/plugins/desk-touchpanel/Cargo.toml
crates/systems/deskc-hirgen/Cargo.toml
  • pretty_assertions 1.3.0
  • chumsky 0.9.2
crates/systems/deskc-mirgen/Cargo.toml
crates/systems/deskc-syntax-minimalist/Cargo.toml
  • parol_runtime 0.16.0
  • anyhow 1.0
  • uuid 1.3
  • env_logger 0.10.0
  • pretty_assertions 1.3.0
  • parol 0.21.5
crates/systems/deskc-typeinfer/Cargo.toml
  • itertools 0.10
  • chumsky 0.9.2
  • ariadne 0.2
  • pretty_assertions 1.3.0
  • env_logger 0.10.0
crates/systems/deskc/Cargo.toml
  • salsa 0.16
  • anyhow 1.0
crates/systems/deskvm-miri/Cargo.toml
  • serde 1.0
  • anyhow 1.0
  • strum 0.24
  • chumsky 0.9.2
crates/systems/deskvm/Cargo.toml
  • anyhow 1.0
  • uuid 1.3
crates/systems/dworkspace/Cargo.toml
  • salsa 0.16
  • serde 1.0
  • downcast-rs 1.2.0
  • anyhow 1.0
  • uuid 1.3
  • mry 0.2.6
github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • actions-rs/toolchain v1
  • Swatinem/rust-cache v2
  • EmbarkStudios/cargo-deny-action v1

  • Check this box to trigger a request for Renovate to run again on this repository

Span data

The current parser emits AST with span data of 0..0. parol have a way to get span for syntax elements.

  • Define SpanStorage trait
  • Use parol with a version that supports span and enable it for generation.
  • Make MinimalistSyntaxSpanStorage able to return span data for any NodeId.

Add N-bit integer types like `i32` and `u8`.

Data

enum Type {
    /// N-bit signed integer
    Signed { bit: u8 },
    //// N-bit unsigned integer
    Unsigned { bit: u8 },
    ...
}

Subtyping

  • uA <: uB if A <= B
  • iA <: iB if A <= B
  • uA <: iB if A < B (0x1111_u can be casted to 0x01111_i)
  • uN <: 'nat for any N
  • iN <: 'int for any N

Coherence

Introducing either or both of the following rules breaks the coherence of the type system

  • ๐Ÿšซ uN <: iN for any N
  • ๐Ÿšซ iN <: uN for any N

For example: Is <'int> 0b11 -1 or 3?

Syntax

'do <'u3> 0b000;
'do <'u8> 0xff;
$ 1_u8;
$ -2_i32;
*<
  & 'u8
  & 'i32
>

Naming of u8

  • Following the naming of 'int and 'nat, it seems that i8 or n8 would be nice. Like i8 is a subset of 'int, n8 is a subset of 'nat. This is not strange.
  • Following that u8 means "unsigned integer", it seems that s8 (means "signed integer") and u8 would be nice.
  • How about p8 (means "positive integer") and i8

But I choose u8 and i8 to minimize surprises for the programmers. Non-programmers may be surprised at u8 but u8 is rare enough for most Desk codes.

How about bits type like b8

It sounds nice, but the following subtyping rules break the coherence of the type system.

  1. bN <: uN for any N
  2. bN <: iN for any N

So we must throw Rule 2 or both of them away.

Rule 1 is safe and uN <: bN is also safe, so we can say uN = uN. uN is used to represent bits in many languages.

Support comments right after `,` or `;`

Syntax

?, // hahaha

?; // yeah

Why?

Sometimes itโ€™s slightly or super annoying to write a comment for an expression.

For example;

// Here is a comment for whole let expression
$ /* Here is a comment for the hole */ ?;

to be:

// Here is a comment for the whole let expression
$ ?; // Here is a comment for the hole

And

*<
    1,
    2,
    // Here is a comment for 3
    3,
>

to be:

*<
    1,
    2,
    3, // Here is a comment for 3
>

How to avoid ambiguity?

Answer: We introduce new tokens, CommaComment and StmtEndComment.

CommaComment: ",[\s--\r\n]*//";
StmtEndComment: ";[\s--\r\n]*//";

Design a generic performant-first interpreter

Current implementation

The interpreter we are using now evaluates MIR (Mid-level IR) directly. It's easy to understand but may have bad performance.
MIR is a collection of CFG (Control Flow Graph), and each instruction of basic blocks is in A-normal form.

Purpose

The purpose is to create a new interpreter for cases that requires a generic performant interpreter.
Because DeskVM can handle multiple types of interpreters, we don't need to replace the current one.

Design requirements

  • It must implement the Interpreter trait.
  • It must be generic because we can have many interpreters specialized for a specific domain.
  • Performant execution is the first, and performant compile is the second.
  • It must have a resource management system such as GC.
  • No JIT compilation (the reason is written in the Related notes).
  • It should be sound.
  • We should keep design and code as simple as possible while performant is first.
  • The interpreter must be suspendable and resumable for scheduling.

Related notes

  • We'll create an AOT compiler in the future.
  • On desktop platform, DeskVM has an ability to run any executable file as a d-process in the VM. It means we can use any executable binary including binaries AOT-Compiled Desk code by just performing a delegation effect in a code. So we donโ€™t need JIT anymore.
  • Since Desk-lang has no side effects, the only side-effective opcode is perform-an-effect.
  • [Needs proof] Because Desk-lang may have a soundish type system, we don't need to worry about crashes by type problem.
  • Desk-lang has no operator other than calling a function.
  • Desk-lang doesn't define built-in functions, so we can define ones for this interpreter.
  • MIR distinguishes data structures such as arrays and linked lists.
  • MIR can contain region-analyzed references.

Related crates

  • deskc-mir defines the structure of MIR
  • deskvm-miri implements the current de facto interpreter
  • deskvm-process defines the process struct like ErlangVM's one and the interpreter trait
  • deskvm implements the virtual machine like ErlangVM

References

  • BEAM bytecode of Erlang VM
  • Ruby bytecode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.