Code Monkey home page Code Monkey logo

argentum's Introduction

Argentum Programming Language

See: Project site

Main language features:

  • Simplicity
  • Syntax driven rock-solid safety
  • Fully automated memory management (no memory leaks)
  • High efficiency
    • No GC (no pauses, no memory and CPU overhead)
    • AOT Compilation
    • Fast interface method calls
    • Fast dynamic casts
  • Designed for large apps
    • Modularity
    • Versioning
    • Built-in unit tests
  • Strict type system
  • Tiny runtime (it is designed with wasm in mind)

Links

Examples

This language is safe and managed, like Java.
These code examples compile into less than 20K Windows executables.
No virtual machine/framework needed.
They can work in a loop forever, no GC pauses, no leaks, no memory corruptions.

Fizz-buzz

using sys { String, log }
using string { Builder }
using utils{ forRange }

b = Builder;
forRange(1, 101, (i){
   i % 3 == 0 ? b.putStr("fizz");
   i % 5 == 0 ? b.putStr("buzz");
   b.pos == 0 ? b.putInt(i);
   log(b.newLine().toStr());
});

Find loop in a graph

using sys { WeakArray, Array, String, log }
using utils { existsInRange }
using string;
using array;

class Node {
    connections = WeakArray(Node);
    isVisited = false;
    isActive = false;
    hasLoop() bool {
        isActive || (!isVisited && {
            isVisited := isActive := true;
            r = connections.contain((c){ c.hasLoop() });
            isActive := false;
            r
        })
    }
}
class Graph {
    nodes = Array(Node);
    fromStr(String in) this {
        byNames = WeakArray.resize('z' + 1);
        getOrCreateNode = () {
            name = in.get();
            byNames[name] || byNames[name] := nodes.append(Node)
        };
        loop {
            from = getOrCreateNode();
            in.get();
            from.connections.append(getOrCreateNode());
            in.get() == 0
        }
    }    
    hasLoop() bool {
        nodes.contain((n){ n.hasLoop() })
    }
}
log(Graph.fromStr("a>b b>c c>d e>f b>e e>a c>c").hasLoop()
    ? "has some loop"
    : "has no loops");

Why not X

There are many programming languages in the wild.

Some of them make programmer to manually allocate and free memory:

  • C
  • C++ (if not using smart pointers)
  • ADA
  • Pascal etc.

Other languages automate this process using mark/sweep or copying Garbage Collector. It simplifies language and ease the programmers life but at the cost. GC-driven languages are slower, they consume more memory (sometimes twice) but what's worse, they always pause applications at unpredictable moments for unpredictable periods. These languages are:

  • Java
  • Go
  • Kotlin
  • Java Script
  • Dart etc.

There are third group of languages, that use semi-automatic approach usualy based on ref-counting. Programmer don't have to think too much on memory management, but their main downside is: memory leaks are possible and in fact without strict discipline they are inevidable. These languages are:

  • Swift
  • Rust
  • C++ (with smart pointers) etc.

Argentum uses neither of these approaches. It distinguishes composition-aggregation-association pointers at syntax level and uses this information:

  • To automate most routine operations on data structures
  • To check the correctness of operations on data structures at compile time
  • To automate lifetime management of object lifetimes, that not only protects from memory leaks but allow to manage all system and hardware resources in a straightforward way.

Let's say it this way: instead of allowing programmers to make a mess out of their data structures (and spend computer resources on handling this mess), Argentum keeps up its data structures in perfect condition all the way. So far no other programming language can do so.

Development

I have a working prototype of the 2nd milestone that includes:

  • Stand-alone compiler producing windows execitables
  • Multithreading
  • Parameterized classes and interfaces
  • String interpolation
  • Frozen-mutable object hierrarchies
  • Fast unwind and direct breaks from nested levels of lambdas

Within the next couple of months I plan to extend the language:

  • Standard container library
  • Port to some platforms (Linux, Wasm, Android)
  • Standard UI library
  • Bindings to curl, databases.

I plan to work alone, though I'd appreciate any feedback and bugfixes in the form of pull requests.

argentum's People

Contributors

karol11 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.