Fork me on GitHub

Katana — have your cake and eat it

What is katana?

Katana is a general-purpose programming language currently under development as a research project at the Department of Computing of the Federal Center of Technological Education of Minas Gerais.

The language goal is to combine JavaScript’s semantics with C’s performance and predictability. Its no-compromise approach makes it ideal for writing games, web servers, compilers and mobile applications.

Once fully-functional, the Katana compiler will use your existing C compiler as a back-end, so that you can quickly get your code running on just about anything.

Katana Compilation Process

Language Features

  • Object Orientation with Prototypal Inheritance
  • JS-Like objects & arrays
  • JSON for denoting object literals
  • First class functions + closures
  • Automatic Reference Counting
  • Late this binding.
  • CommonJS-like modules with automatic compilation of dependencies
  • Small runtime library
  • C-like syntax
  • Optional Python-like offside syntax

What does it look like?

Katana’s syntax makes the language look very similar to other C-like languages. At the same time, it allows for optional indentation-defined blocks, and for the omission of semicolons.

import read, write from io/sync;

int n = read();

var factorial = take x {
  if x > 0 {
    return x * factorial(x - 1);
  } else {
    return 1;
  }
}

int r = factorial(n);

write(r);
import read, write from io/sync

int n = read()

var factorial = take x ->
  if x > 0 ->
    return x * factorial(x - 1)
  else ->
    return 1

int r = factorial(n)

write(r)

Quick Info

The Katana Programming Language

Syntax C-like
Paradigms Imperative, Object-Oriented (Prototypal), Functional
Typing Discipline Strong & Static, Weak & Dynamic
Influenced By C, D, JavaScript, CoffeeScript

The Katana Compiler

License MIT
Github Repo https://github.com/coreh/katana