Share your Programming Language Jam submissions here!

← Back to all posts
Rex Programming Language!
AmazingMech2418 (943)

Repls:
Rex Web: https://repl.it/@AmazingSquidYes/Rex-Web (main repl currently)
Rex C++: https://repl.it/@AmazingSquidYes/Rex-C

Rex Programming Language

Welcome to Rex! Rex is a prototypal object-oriented language developed by me, @DynamicSquid , and @HahaYes , also known as the @AmazingSquidYes team!

Rex is designed for graphical applications, data science, and easy-to-maintain codebases. Rex Web will be the first to pioneer ReXML built-in XML parsing to be used in DOM components similar to those in the popular JS framework, React. Additionally, Rex Web will be the first to pioneer the BigInt decimal system which will revolutionize data science by allowing maximum precision for floating point numbers without requiring a module!

Rex is still in the relatively early stages. Here is the history of Rex!

History

At the start of this code jam, @HahaYes, @DynamicSquid, and I decided to form the @AmazingSquidYes team for the code jam. As the jam kicked off, we started working on AdaptX, a customizable language, but, in the middle of the code jam, we decided to think more about functionality and usability. People don't need a language they can use with Lisp, C, and Python style syntaxes, but what people do need is a simple, yet effective language for many applications from graphical apps, data science, and more while also including maintainability through object-oriented programming!

Eventually, we decided we would make 2 versions of the language. A console version done in C++, and a web version done in JS. The web version is, as you can call it, the "main" version with most of the features, while the console version is still very new and experimental at this moment.

The reason we decided to go with 2 separate versions is to expand the niche of this language to other fields, but again, the console version is still a new idea and is not fully ready yet.

About The Prototypal OOP System

Most OOP is classical, using classes and sometimes interfaces, or struct-based, using structures, but then, there is prototypal OOP such as what is used in languages such as JavaScript and SmallTalk. Instead of using classes, everything is based on objects, the true original goal of object-oriented programming. However, even JavaScript has its shortcomings in OOP. For example, it still uses either functions or pseudo-classical systems for prototypes! However, if we could make prototypes simply objects, that would fix all of the problems of "fake" OOP! And that's what we did with Rex!

Where JS would use

function Class() {
  this.property = "property value";
  this.method = () => {
    // Code here
  };
}
Class.staticProperty = "static property";

or

class Class {
  constructor() {
    this.property = "property value"; 
  }
  method() {
    // Code here
  };
}
Class.staticProperty = "static property";

Rex uses the simplicity of objects to its advantage!

For example, it would use

obj Class = {
  obj prototype: {
    str property: "property value",
    fn method: fn() {
      // Code here
    }
  },
  str staticProperty: "static property"
}

This modification of prototypal OOP includes all of the great things about classical and prototypal OOP while realizing the original dream of object-oriented programming by making everything based on objects, not simply classes, structs, or functions. Like in Java, you can have static methods. Like in JavaScript, you can interact with a "class" as an object. Like in C++, you can define types of different properties. It has all of the best parts of these object-oriented programming paradigms!

Easter Eggs!

Our language can't be boring! It is the 21st Century! Like Python and Linux terminals, we have our fair share of Easter Eggs too! What can be better than having all of our judges in ASCII art! We have all four judges in ASCII art, and they look cool! We also have @amasad on as ASCII art too! If you have been on Repl.it for the past few months, you would have seen Squid's awesome pixel art creator project. It was one of the most innovative projects that were created on Repl.it. So, we made pixel @amasad into ASCII @amasad . How cool is that! In the future, we might add all Repl.it employees and some others to our ASCII list! The ASCII art was created by HahaYes (we do not know how much pain it was to make them).

To see the Easter Eggs in Rex Web, just do the following:

obj eastereggs = import("#eastereggs");
eastereggs.amasad();
eastereggs.deweese();
eastereggs.jordan();
eastereggs.mary();
eastereggs.stephan();

Rex C++ has the same easter eggs, but they need to be reworked to function in the same way as Rex Web.

Coming Soon

Rex has many features coming soon that we haven't had enough time to include in the alpha version for this code jam, including the following:

ReXML

ReXML will use a native XML parser to help manipulate the HTML DOM in Rex Web and produce quality graphical user interfaces for applications, whether mobile, desktop, or web in the application development Rex environments! ReXML will utilize ideas from the React JavaScript framework, specifically JSX, to make application development as easy as possible! Unfortunately, examples cannot be included as this is an upcoming feature, not a current one.

BigInt Decimal System

Utilizing JavaScript's BigInt data type and recreations in other languages such as C++, the BigInt Decimal system is efficient and has as much accuracy as you could possibly want! Of course, accuracy cannot be infinite due to memory overloads, but accuracy is dynamic, so you could start with zero decimal places and move up to a thousand or more by the end of your program! Additionally, the BigInt type will be used for integers by default, so you don't have to worry about integers being put into scientific notation or Infinity automatically. This could revolutionize data science by providing efficient and extremely accurate and precise calculations. Once added, there will be a new dec type for decimals and a modified int type using BigInt instead of just normal integers in the JavaScript version!

Upgraded Console Version

Right now, the console version is lacking features, and in incomparable to the web version, but that all will soon change as we add important features that will make the console version have the same functionality as the web version, but for the console.

Operators

Currently, Rex Web does not have operators, but that will change soon once we add them. Operators are planned after improving the typing system and including the usage of the this keyword in methods as well as adding constructors.

Closures

Closures are not currently supported, but soon will be using cached memory in functions! This will come with the this keyword in methods.

Syntax Overview

Here is a syntax overview for the Rex Programming Language!

Currently, there are four data types: str, int, obj, and fn. Eventually, other data types such as dec, arr, bit, and op (only in methods) will be added as well. str is the basic string data type. Currently, it doesn't have too much functionality and is no different than int at the moment. However, once the this keyword and constructors are added, both str and int will be fully functional string and integer data types! There are also, unfortunately, no operators currently besides assignment operators. Once operators are added, loops and conditionals will be as well. I know this means that the language is largely incomplete currently, but loops and conditionals will use the C-style syntax.

Objects

The obj type is the data type for objects! Using RexON (Rex Object Notation), this data type is the most basic of all of them! Eventually, when strings and integers are reworked and other types are added, they will all inherit from this type! Here is an example of RexON:

obj test = {
    str a: "Hello world!",
    int b: 3,
    obj c: {
        fn method: fn() {
            print("This is called from a method!");
        }
    }
};

RexON also supports adding in a prototype property to create prototypes. This is the basics of OOP in Rex! Soon, the op type will be added to support operator overloading.

Functions

Functions in Rex can be defined in two ways as follows:

fn myFunction(int param1, str param2) {
   // Code here
}
fn myFunction = fn(int param1, str param2) {
   // Code here
}

The first is a regular function declaration and the second is using anonymous functions. Both, however, work. You can also use anonymous functions in parameters, objects, and variables. Additionally, some functions are native. You cannot declare a native function in Rex since they are written directly into the JS code behind the language.

I/O

Currently, Rex does not yet have any input, but does have a print function! Rex will gain a lot more I/O capabilities with ReXML.

Unfortunately, the rest of the syntax is still largely under development. There is also an import function, but only one module is currently supported and self-made modules are currently not supported.

The Goals of Rex

The goals of the Rex Programming Language are to make a language good for data science, console applications, and graphical applications while also truly realizing the original dream of object-oriented programming. In the development of this language, spanning only 10 days due to the change in plans mid-jam, we mainly focused on getting a basic memory system and object-oriented programming system. We also included easter eggs for a competitive advantage, but most effort was put into the actual language, not the easter eggs. While Rex is not super powerful currently, it will be very soon!

Roles in @AmazingSquidYes

  • Me ( @AmazingMech2418 ) - Lead Rex Web developer, team founder, and primary language designer
  • Squid ( @DynamicSquid ) - Lead Rex C++ developer and language designer
  • @HahaYes - Head of easter eggs, ASCII art, and branding and emotional support for Squid

If you have any questions about the current capabilities or future plans for Rex, please ask in the comments of this post!

Commentshotnewtop
fuzzyastrocat (1262)

Hey it's out! Nice job

AmazingMech2418 (943)

@fuzzyastrocat Thank you and you're welcome I guess! LOL!

fuzzyastrocat (1262)

@AmazingMech2418 Well you're welcome and thank you I guess!

Wait a minute, I sense an endless loop
Kookiez (219)

@fuzzyastrocat we have the same number of cycles

fuzzyastrocat (1262)

@OrangeJooce123 whooooaaaaa
Are we... the same person in alternate realities?

fuzzyastrocat (1262)

@DynamicSquid @OrangeJooce123 Nooooo the synchronicity has been broken

HahaYes (1248)

TEAM AMAZINGSQUIDYES FTW

fuzzyastrocat (1262)

@HahaYes Team curtadev FTW!
(well ok, I explicitly said in my post I don't want to win the whole thing)

HahaYes (1248)

@fuzzyastrocat well. We'll know in a bit.

fuzzyastrocat (1262)

@HahaYes No one has commented (or even looked at for all I know) Curta, let alone upvoted (I upvoted Rex :D)... mind checking it out? https://repl.it/talk/challenge/Curta-Lets-make-hard-things-easy/51820

HahaYes (1248)

@fuzzyastrocat just uh... don't advertise... mods don't like that

fuzzyastrocat (1262)

@HahaYes I'm not advertising, I just want some criticism :D

fuzzyastrocat (1262)

@HahaYes LOL didn't realize the number at the end mattered (link is updated)

HahaYes (1248)

yay the easter eggs worked out great!

HahaYes (1248)

I'm also the emotional support guy XD

AmazingMech2418 (943)

"If your question has been answered, select it below." What? This isn't the "ask" board!

fuzzyastrocat (1262)

@AmazingMech2418 I get this on my Curta post as well. Not sure what's going on, must be some internal bug.