Giter Site home page Giter Site logo

umpteen's Introduction

The Umpteen Programming Language

This repository provides the reference implementation for the Umpteen Programming Language, bootstrapped from Rust. Umpteen is currently in development and frequent breaking changes are expected until v1.0.x

As such, Umpteen is not yet recommended for use in production

Syntax

Comments

Write a line comment with # or a block comment with opening and closing ###

# This is a line comment

###
This is a block comment
Continued over multiple
lines
###

Variables

Create mutable or immutable* bindings with var and let respectively

var x = 10; # x is mutable
let y = 20; # y is immutable
x = 0; # OK โœ…
y = 0; # ERROR ๐Ÿšซ

*NOTE: Immutable bindings are not yet implemented

Scope

# Global Scope

let a = 10;
print(a); # 10
{
  # Block-scope
  print(a); # 10

  let a = 20;
  print(a); # 20
}

print(a); # 10

Shadowing*

Immutable bindings support shadowing within the same scope

let a = 10; # OK โœ…
let a = 20: # OK โœ…
a = 30; # ERROR ๐Ÿšซ

*NOTE: Shadowing within the same scope is not yet implemented

Mutable bindings can be reassigned, however they are not permitted to be shadowed within the same scope. Conversely, shadowing is permitted within a narrower scope

var a = 10; # OK โœ…
{
  var a = 20; # OK โœ…
}
a = 30; # OK โœ…
var a = 40 # ERROR ๐Ÿšซ

Conditionals

Test an expression with the if keyword

if true {
  print("This code prints!"); # โœ…
}

if false {
  print("This code is unreachable"); # โ›”
}

As well as else and else if

let something = false;
let somethingElse = false;

if something {
  print("Something!");
} else if somethingElse {
  print("Something else!");
} else {
  print("Neither!");
}

Loops

Execute statements multiple times with the loop keyword. Use break to exit early from the loop body, or continue to halt execution of the current iteration and skip to the next one

var i = 0;
loop {
  print(i);
  i += 1;

  if i > 10 {
    break;
  }
}

Functions

Declare a function with the fnc keyword. Parameters require type annotations. Annotations for return types are required, unless the function returns Empty

fnc fib(n: Number) -> Number {
  if n <= 1 {
    return n;
  }

  return fib(n - 2) + fib(n - 1);
}

Data Types*

  • Empty: No value
  • Boolean: true or false
  • Number: IEEE 754 double-precision floating point representation of numerics
  • String: A series of characters
  • Object: Compound data types passed by reference instead of by value
    • Fnc: Function type representing a discrete collection of executable instructions
      NOTE: User-defined functions are not yet implemented
    • List: Dynamic Array type, representing a one-dimensional dynamically resizeable numerically indexed collection

*NOTE: The full specification for Umpteen's type system is not yet defined, definition of all types is subject to change prior to v1.0.x


WARNING: Umpteen is still in active development and frequent breaking changes are expected prior to v1.0.x. Not yet recommended for production use!

umpteen's People

Contributors

347online avatar

Stargazers

Eric Chianti avatar Torin avatar Daniel Jost avatar Miguel Obando avatar

Watchers

 avatar

Forkers

obando777

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.