Giter Site home page Giter Site logo

oxidic / oxido Goto Github PK

View Code? Open in Web Editor NEW
9.0 0.0 3.0 282 KB

Oxido is a statically typed interpreted programming language for making CLI tools and scripts.

Home Page: https://oxido.megatank58.xyz

License: MIT License

Rust 91.88% Shell 7.87% Makefile 0.25%
language rust oxido hacktoberfest

oxido's Introduction

Oxido

Oxido is a statically typed interpreted programming language for making CLI tools and scripts.

Files:

The files may end with the oxi extension, however the extension is ignored.

Oxido uses waterfall approach to files, for a directory/file example, Oxido will run the first file in order of, example, example/main.oxi, example/src/main.oxi.

Installation

Oxate, the official installer can be used to install the latest release from GitHub.

oxate install

Uninstallation

You can use oxate to remove the current installation.

oxate uninstall

Usage

You can run an Oxido file using the oxido command. The files may end with the oxi extension, however Oxido ignores the extension, and runs the file as-is.

oxido <FILE> [OPTIONS]

For example:

oxido main.oxi

Conventionally, Oxido files are named main.oxi.

Syntax

Data types

  • String: A string is any value inside " (double quotes) passing the regex \"[A-Za-z0-9 !]+\".

  • Int: Integers (no fractions), passing the regex [0-9]+.

  • Bool: true or false

  • Vec: A uniform collection of the other data types, denoted by [T].

Variables

Variables are declared by the let keyword, followed by the identifier, which must pass the regex [A-Za-z]+, followed by the data type (optional) and an equal sign and the expression.

For example:

let a: str = "Hi mom!";
let n = 5;
let z = 5 * 5;
let f: int = factorial(5);

Reassignments

Reassignments are the same as assignments with the condition that let keyword is not used and the variable must have been declared before. Data types are enfored while reassigning values.

let a: int = 0;
a = 5;
a = 5 * 5;
a = factorial(5);
a = "Hi mom!"; // error: incorrect data type

If statements

If statements check whether the given condition is true or not using the == or < or > operator. The == is applicable on strings and integers both, while < or > can only be used on integers. The condition must be followed after the code to be executed in the case the condition is true in curly braces {}.

if a == 5 {
    print(a);
}

Loop statements

Loop statements repeat given conditions until break is called.The conditions to be executed in the loop must be followed after the loop keyword in {}.

let b = 0;

loop {
    b = b + 1;

    if b == 5 {
        print("Hi mom!");
        break;
    }

    print(b);
}

Functions

Funcitons store the given conditions until they are called. They are declared with the name of the function, the name must be a valid identifier, followed by args, seperated by commas in () and the statement in {}.

let text = "Hi mom!";

fn message(x: str) -> int {
    print(x);
    return 0;
}

message(text);

Exiting

The exit keyword can be used to exit the program with the specified exit code

print("Hi mom!");

exit(0);

Standard Library

Oxido includes a standard library which can be used for basic functions.

IO

print()

Print the given inputs to stdout.

println()

Print the given inputs to stdout and leave a newline.

Types

str()

Convert the value to str data type

int()

Convert the value to int data type

bool()

Convert the value to bool data type

oxido's People

Contributors

megatank58 avatar realm2100 avatar savioxavier avatar togarashipepper avatar apoorvcodes avatar

Stargazers

Marcelo Henrique Neppel avatar Neutron avatar Simon Curtis avatar GodderE2D avatar vuax avatar cheeze2000 avatar Tristan Camejo avatar  avatar  avatar

oxido's Issues

Module System

I was curious as to how you're going to do modules? I've looked in a lot of places for inspiration, but cannot find any solid references

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.