Directory Structure

A Letlang project MUST follow this structure:

flowchart TB / --> letproject.toml / --> src/ / --> .llbuild/ src/ --> src/foo.let[foo.let] .llbuild/ --> .llbuild/Cargo.toml[Cargo.toml] .llbuild/ --> .llbuild/lldep_foo/["lldep_foo/"] .llbuild/ --> .llbuild/executable/["executable/"] .llbuild/lldep_foo/ --> .llbuild/lldep_foo/Cargo.toml[Cargo.toml] .llbuild/lldep_foo/ --> .llbuild/lldep_foo/src/["src/"] .llbuild/lldep_foo/src/ --> .llbuild/lldep_foo/src/lib.rs["lib.rs"] .llbuild/executable/ --> .llbuild/executable/Cargo.toml[Cargo.toml] .llbuild/executable/ --> .llbuild/executable/src/["src/"] .llbuild/executable/src/ --> .llbuild/executable/src/main.rs["main.rs"]

The .llbuild/ directory MUST be generated by the compiler.

Project Configuration File

The letproject.toml file MUST respect the following JSON schema:

{
  "type": "object",
  "properties": {
    "package": {"$ref": "#/definitions/package-settings"},
    "toolchain": {"$ref": "#/definitions/toolchain-settings"},
    "executable": {"$ref": "#/definitions/executable-settings"},
    "dependencies": {"$ref": "#/definitions/dependencies-settings"}
  },
  "required": ["package", "toolchain"],
  "definitions": {
    "package-settings": {
      "type": "object",
      "properties": {
        "name": {"type": "string"},
        "version": {"type": "string", "format": "semantic-versionning"},
        "description": {"type": "string"}
      },
      "required": ["name", "version", "description"]
    },
    "toolchain-settings": {
      "type": "object",
      "properties": {
        "letlang": {"type": "string"},
        "rust": {"type": "string"}
      },
      "required": ["letlang", "rust"]
    },
    "executable-settings": {
      "type": "object",
      "properties": {
        "bin": {"type": "string", "description": "Filename of the executable"},
        "module": {"type": "string", "description": "Path of the Letlang module containing the main function"}
      },
      "required": ["bin", "module"]
    },
    "dependencies-settings": {
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {"$ref": "#/definitions/dependency-path"},
          {"$ref": "#/definitions/dependency-registry"}
        ]
      }
    },
    "dependency-path": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string",
          "description": "Local filesystem path, either absolute or relative to the project's root"
        }
      },
      "required": ["path"]
    },
    "dependency-registry": {
      "type": "object",
      "properties": {
        "version": {"type": "string"}
      },
      "required": ["version"]
    }
  }
}

Example:

[package]
name = "hello-world"
version = "0.1.0"
description = "Hello World program"

[executable]
bin = "hello"
module = "hello::main"

[toolchain]
letlang = "0.1.0"
rust = "2021"

[dependencies]
stdlib = { path = "../../lib" }