Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

216 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

petal 🌸

Petal is a hobby programming language with a compiler transpiler (to C) written in Rust. A LLVM (or maybe Cranelift) compiler backend will be added in the future.

Roadmap

  • Basic function declarations (parameters, return types)
  • Signed and unsigned integer types
  • Variable declarations
  • Function calls (arguments)
  • Basic type-checking
  • Variable assignment
  • Named function call arguments (myFunc(value: i32))
    • Make positional parameters the default, with ~ signifying a named parameter.
  • Booleans
  • Control flow (if, while)
  • Equality operands (==, !=)
  • Smart type inference for integers
    • For example, i64 a = 5; should compile, but it does not as 5 is always treated as an i32. It should be inferred to be an i64 (if the literal fits in the width).
  • Multiple module support
    • Private module members by default (expose via public keyword)
    • Name mangling
  • References
  • User defined types (type CString = &u8)
  • Structures
    • Member access
    • Member function declarations
    • Member function calls
  • Optionals (type Optional<T> = { is_present: bool, value: T })
    • Short-hand via type modifiers, e.g. ?i32.
    • Smart casting
  • Basic generics
    • Generic functions
    • Member functions of generic types (func <T> Foo<T>.bar())
    • Generic type argument inference
  • Enums
    • Tagged unions?
  • Arrays
  • IR
  • ...
  • Website/playground REPL
  • LLVM or Cranelift backend

Contributions

Anyone is open to making a pull request! Before you do, please ensure that the feature you are adding is documented on a GitHub issue, and has been approved by @caoimhebyrne.

I request that any code submissions are not entirely AI written. If you are going to use AI tools on this project, then:

  • Ensure that you understand the code that it is producing.
  • Guide the AI using your existing knowledge and ideas.

License

This project is licensed under the Apache License 2.0 license.

About

🌸 A hobby programming language written in Rust

Resources

Stars

3 stars

Watchers

1 watching

Forks

Contributors

Languages