Skip to content

HENRDS/niffin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Niffin

A tiny statically typed scripting language.

Why the name?

Because I'm a fan of The Magicians and niffin is a cool name for a language.

Based on ...

The language syntax is based on:

  • Nim
  • C
  • Rust
  • Lox

Samples

Hello world:

# this is a comment
print("Hello world!");

Constants:

discard 0b110;
discard 0o777;
discard 0x1f;
discard 23;
discard 23.32;
discard 6.02e23;
discard "Hello";

Declarations:

var x = 0;
# vars can be reassigned
x = 1;

let y = 2;
# let bindings cannot be reassigned
# y = 3 # <- error

# proc's can have side effects
proc incX(){
    x = x + 1;
}

# fun's are pure functions
fun add(a: int, b: int): int {
    return a + b;
}

UFCS:


fun add(a: int, b: int): int {
    return a + b;
}

# The following are all equivalent
discard 1.add(2);
discard add(1, 2);

To do

  • Lexer
  • Parser (in progress)
  • Resolver (in progress)
  • Type checker
  • Virtual machine

About

A tiny statically typed scripting language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages