Skip to content
Projetos

Sobre

Compilador da linguagem de programação Valen

Linguagens e ambientes de execução

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
-1
em 7 dias
0
em 15 dias
+6
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

Valen

Valen is a programming language that aims to be not only fast and memory-safe, but also easy and flexible.

NOTE: Valen is still a prototype and barely past the proof-of-concept stage. There are holes and sharp edges. For example, String and HashMap require some more Rust-interop work. After a few months of solidifying and stabilizing, we'll release a 0.1 version that's nice and usable for basic cases. Stay tuned!

Our plans for Valen:

  • Ecosystem: Valen is able to call into existing Rust libraries, see The Golden Spike, and Resurrecting the Vale(n) Programming Language
  • Speed: Valen is AOT compiled to LLVM, statically-typed, and aims to be the fastest safe language, by giving more fine-grained aliasing information to LLVM.
  • Safety: For memory safety and data-race safety, it uses the new group borrowing technique, which is like a more flexible borrow checking, with mutable aliasing.
  • Flexibility: We'll be adding generational references and reference counting, which should be usable without Cell, RefCell, etc.

Running a Valen Program

  1. Build the Valen compiler:
    • Clone the repo, git clone https://github.com/valen-lang/valen ~/valen
    • cd ~/valen
    • cargo build --bin valec
  2. Make a directory for your Valen project:
    • mkdir ~/my_valen_project
    • cd ~/my_valen_project
    • mkdir src
    • Make a src/main.valen containing exported func main() int { return 42; }
  3. Compile and run your Valen project:
    • Compile: ~/valen/target/debug/valec build --no-std --builtins-dir-override ~/valen/src/builtins/resources main=src
    • Run: build/main
    • See the result: echo $? (should be 42)

Running a Valen Program with Rust Libraries

  1. Install and compile the patched version of rustc. WARNING: This is a version of rustc that we modified, it is NOT the official rustc!
    • git clone https://github.com/valen-lang/rust ~/rust
    • cd ~/rust
    • git checkout per-instance-mir (This is the branch with our rustc patches)
    • Add to config.toml:
      [llvm]
      download-ci-llvm = false
      link-shared = true
      
    • ./x build
    • ./x build --stage 2
    • rustup toolchain link rustc-for-valen ~/rust/build/host/stage1
    • ln -sf ~/rust/build/host/stage0/bin/cargo ~/rust/build/host/stage1/bin/cargo
  2. Build the Valen compiler:
    • Clone the repo, git clone https://github.com/valen-lang/valen ~/valen
    • cd ~/valen
    • cargo +rustc-for-valen build --features rust_interop --bin valenc-rs --bin valen
  3. Make a directory for your Valen project:
    • mkdir ~/my_valen_project
    • cd ~/my_valen_project
    • Add a Valen.toml:
      [project]
      name = "test_project"
      version = "0.1.0"
      edition = "2021"
      
      [rust-dependencies]
      chrono = "0.4"
      
      [[bin]]
      name = "main"
      source = "src/main.valen"
      
    • Make a src/main.valen:
      import chrono.TimeDelta;
      
      exported func main() i64 {
        d = TimeDelta.seconds(42i64);
        return d.num_seconds();
      }
      
  4. Compile and run your Valen project:
    • Compile: COMPANION_RUSTC=$(rustup which --toolchain rustc-for-valen rustc) ~/valen/target/debug/valen build --manifest-path Valen.toml
    • Run: target/valen-build/target/debug/main
    • See the result: echo $? (should be 42)

Let us know if the above sequence of commands doesn't work for you.

Historical Notes

Valen is the successor to the Vale programming language.

Thank you to everyone who sponsored Vale! Vale existed because of your support, and Valen exists because Vale existed. Thank you to all of Vale's sponsors:

Explore projetos relacionados

Carregando…