Skip to content

villagekit/kittylang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kitty Lang

Kitty Lang is a work_in_progress programming language, basically "what if Rust was a friendly scripting language".

Kitty Lang is intended to be used as the foundation for Village Kit, a future-thinking code-as-CAD system for open source makers.

Principles

  • Accessible to beginners, like Logo
  • Powerful for experts, like Haskell
  • Structs and traits, like Rust
  • Embeddable, so can be used in web or native apps
  • Language-aware, so compiler can be used as linter, formatter, language server, etc
    • Even if some syntax is wrong, the compiler is able to parse the remaining correct syntax and still give useful feedback
  • Debug-friendly, so you know exactly how and why something went wrong
  • Evaluation-aware, so you even know where values come from
    • Every value has a reference to the code span which created it
    • This is important for code-as-CAD editors where you can interact with an object in 3d space and it performs a macro on the code
  • Secure, so you are safe with untrusted input
  • Inspired by future-thinking languages: Julia, Flix, Gleam

Progress

At the moment

  • Lexer (String -> Tokens)
  • Parser (Tokens -> Concrete Syntax Tree)
  • Analysis (Concrete Syntax Tree -> High-level Intermediate Representation)
  • Evaluator (High-level Intermediate Representation -> Value)
  • ???

Language

(Incomplete)

  • Rust-like type system
    • Primitives
      • (): Unit type
      • Number
      • String
    • Compound types:
      • (T, U...): Tuple
      • List
    • Enum types:
      • Boolean
      • Option
      • Result
  • Functions can be called with either positional args or keyword args
    • Type generics are the same
  • Functions can describe multi-arity multi-type overloads
  • Only top-level declarations and expressions
    • In let, a newline is an implicit in.
  • Use only where clause to describe type trait bounds, not in generic params
  • Use . instead of :: for type paths
  • Use [] for generics, use () for tuples, use List() for lists, use list.get and list.set for get and set.
    • Although Flix seems to be able to use [] for generics AND lists.
  • Use labelled arguments like Gleam: https://tour.gleam.run/everything/#functions-labelled-arguments
  • Match like Gleam: https://tour.gleam.run/everything/#data-types-record-pattern-matching
  • True and False are part of a Boolean enum
    • but they are aliased so you can use as True and False.

About

What if Rust was a friendly scripting language?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages