Giter Club home page Giter Club logo

uranium_lang's Introduction

Uranium Lang

This is an open-source project, feel free to contribute

Uranium Lang - Features & Syntax

Variables

Primitive Datatypes:

  • int
  • float
  • string
  • bool

Decleration and Assignment

// decleration (doesn't work at the moment)
name: datatype

// assignment
name: datatype = value

Example:

number: int = 0

The main function

func main() -> int {
	return 0
}

Functions

func name(param_name: param_type, ...) -> return_type {
	// your code goes here
}

Example:

func add(a: int, b: int) -> int {
	return a + b
}

Please Note: Functions cannot be called yet (I might have fixed this already)

Comments

As of right now Uranium Lang only has support for single-line comments, multi-line comments will be added in the future.

// This is a single-line comment

If, Else if, Else

if condition1 {
	...
} else if condition2 {
	...
} else {
	...
}

Example:

num: int = 10
if num < 5 {
	// do something here
} else if num > 5 {
	// do something else here
} else {
	// do something here too
}

While loops

while condition {
	...
}

Example:

num: int = 0
while i < 10 {
	i = i +1
}

For loops

Uranium Lang will support different types of for-loops, however only the classic iterative for-loop is implemented right now.

for name: datatype = value, condition, de/- incrementation value {
	...
}

Example:

for i: int = 0, i < 10, 1 {
	// this achieves the same as the above while loop example
}

Uranium Lang - How does it work

The Uranium Compiler "runs through" your source code and tokenizes it. The resulting tokens are then rearranged and resstructured so that they can be translated to C++ more easily. Yes, Uranium Lang is not directly compiled to machine code, it gets compiled into C++ and relies on an external C++ Compiler to do the rest of the compilation.

Importance of XML

Uranium Lang depends on various XML files, such as the ones for token generation, the new parser also heavily relies on them. The reason for that? Customization! Don't like a feature of the language? Just change the right XML file appropriately and you can tailor it to your liking! Is this feature a good idea? Probably not, but it stays nevertheless.

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.