Thanks to visit codestin.com
Credit goes to github.com

Skip to content

nh3dev/sharc

Repository files navigation

This project is now under the free ammonia foundation :0

Shard is still at a VERY EARLY STAGE, like not even usable yet
If you like this concept then PLEASE help out
I cant do it all by myself.. :/

Contributing Checklist

Examples

let x = 5;
let addx = |y| x + y;
add(10)
let printf_int = extern "printf" |fmt: raw &[u8], i: i32|: i32;
printf_int("hello %d\n\0", 5 + 10);
let average = |nums: &[u32]|: u32 {
	let sum = loop let (sum, i) = (0, 0) {
		if i == a.len { break sum; }
		(sum + a[i], i + 1)
	};
	sum / a.len
};

average(&[1, 2, 3, 4, 5]) // => 3
let Box = |t: type| raw &mut t;

let<T> box = |v: T|: Box(T) {
	let<T> malloc = extern "malloc" |size: usize|: raw &mut T;
	let ptr = malloc(core::tyinfo(T).size);
	*ptr = v;
	Box(T)(ptr)
};

impl<T> core::Drop |self: Box(T)| {
	let<T> free = extern "free" |ptr: raw &mut T|;
	free(self);
};

let x: Box(i32) = box(5);
core::Drop(x);

TODOS

  • fix debug formatting for ast/hir to do proper indentation
  • get the website back up
    • move shard to faf (also make a faf org)??
    • update sherbert with new docs
    • sherbert fix syntax highlighting (prob get docs first)
  • diff syntax for < since that conflicts with type generics Foo<Bar>
  • define move semantics. what's copy by default?
  • bully @interacsion into either making a borrow checker or shutting up about it :) (preferably option b)
  • do actual trait resolution
  • integrate core traits as operator overloads
  • draft up shard docs:
    • basics + typing
    • core lib
  • update nightly version to one with good features/stability
  • fix the bump allocator
    • miri error (rust bs semantics are driving me crazy)
    • possible double free on panic? (needs investigation)

About

Shard: a functional flavoured imperative language

Topics

Resources

License

Stars

Watchers

Forks

Contributors 9

Languages