[v1.4] Epoxy Programming Language

What is Epoxy?

Epoxy is an interpreted programming language with a similar syntax design to lua. Originally, Epoxy was written in JavaScript, then I later ported it to Roblox; which is the topic of this post. This release of the language is designed for roblox, although I still need to work out a few things.


What does this language offer?

This language offers support for syntax features that have yet to come to Luau. An example of this would be function parameter defaults:

fn AddTwoNumbers(a:1,b:2)
	return a+b
cls

log(AddTwoNumbers(1,2)) -- 3
log(AddTwoNumbers(1)) -- 3
log(AddTwoNumbers()) -- 3

Epoxy also has other statements like constant variables and switch statements:

fn SwitchTest(x)
	switch x do
		case 1 do
			log("x is 1")
		case 2 do
			log("x is 2")
		default
			log("x is not 1 or 2")
	cls
cls

SwitchTest(1) -- x is 1
SwitchTest(2) -- x is 2
SwitchTest(3) -- x is not 1 or 2
const MyVariable: "Hello, world!"

log(MyVariable) -- Hello, world!

MyVariable: "This will error!"

General Information

Since Epoxy is an interpreted language, one thing that it lacks is speed. From some benchmarking tests, I can see that this release of the language pretty much pairs up with the one I wrote in JavaScript. The reason this is an interpreted language is because I still haven’t came up with a good method to generate compiled code. Any break-throughs will help make this language compiled in the future.
Benchmarking Test:

var t: time()
loop i:1;i<=10000;i+:1 do

cls
log(time()-t) --This takes about 0.07263 seconds

Release Information

Epoxy on GitHub (JavaScript Release), also has documentation
Epoxy on Roblox


Notes

  • There may still be a lot of bugs in this language that I have yet to encounter. If you find any please contact me with specific information about a bug.
  • The standard library for this language is still being developed. I will be adding more functions and libraries to it in the future.
  • This language has no user-defined type system at the moment.

Plans

  • Epoxy script editor plugin
  • Compiled release?
  • Improved standard library and code execution method

I am open to suggestions about this entire project, if you have any let me know. Have a nice day! :slight_smile:

7 Likes

so why would i want to use this over luau other than what you showed us above

One reason in which this should be used rather than Luau is if you want to make a game where users can write their own code, considering that it’s very easy to limit what the user can and can’t do in the language. Maybe developers just want to experiment with it. Although I don’t see this as having widespread usage, it’s a neat little concept for developers to play around with if they so desire. Maybe in the future I can transpile this language to luau code so it’s fast; that will allow a lot more to be done with the language.

3 Likes

this is a really cool and ambitious project, i wish you luck with your future endeavors!

1 Like

Interesting, syntax is the only change I see. Making the syntax more complex but hold the same features as luau is not so helpful.

Could I get some examples where this could do stuff luau can’t?

There are some syntax differences, like for example, tables in lua are created with {}, but in Epoxy this is how you define in Object. There are two different syntaxes for arrays and objects:

[ --Array
    1,2,3,
] 
{ --Object
    Test: "Hello, world",
} 

The language also supports function parameter defaults:

fn AddTwoNumbers( Number1: 1, Number2: 2 )
    return Number1 + Number2
cls
AddTwoNumbers(1,2) --3
AddTwoNumbers(1) --3
AddTwoNumbers() --3

It also has some other smaller syntax features, like creating a range of numbers:

1..3 --The same as [1,2,3]

You can also do more advanced things like the do expression:

do(1,2,3)+1 --The result of this is [2,3,4]

Edit: Fixed syntax issue in example
Late Edit: Fixed object syntax issue

There were also some updates made to the JavaScript version which have yet to be ported over to the luau version. I plan to work on some of these features in the next update.
This includes the if expression: if <Condition> then <Expression> else <Expression>, and a complex operator for updating variables in a specific way.

Hello everyone reading this! I am here to announce, in the comments, that I have released Epoxy version 1.3. This Luau version is now on-par with the JavaScript version. Have fun using if expressions & the complex assignments operator.

Here is an example of the complex assignment operator

--OLD
var Test: workspace
Test: Test>>FindFirstChild("Baseplate")
--NEW
var Test: workspace
Test = >>FindFirstChild("Baseplate")
log(Test.Name) --Baseplate

The complex assignment operator will set the given variable or index to itself using a complex expression with itself.

As always, the syntax tests of these features can be found inside the model linked on this post labeled Epoxy in Roblox

Hello! This has been bumped up for version 1.4 release.
I bring you, in this version, two new syntax features, and patched a couple of bug that somehow slipped into production.

Syntax Feature #1: Multi-Call Operator
This exists for people spamming function calls of the same function in a row; well no need for that anymore!

fn Add(a,b)
	return a+b
cls

dvar a,b,c: Add|(1,2)(10,20)(100,200)|

log(a,b,c) --Output should be 3 30 300

Syntax Feature #2: in operator
Inspired from some other languages, and overall a better alternative to some things, this operator can help check if something is in something else:

log("hi" in "hills") --true
log("hi" in ["hi"]) --true
log("hi" in {hi: "yup! It's here"}) --true
log("hi" in "hello") --false

The Bug Fixes

  • Oddly enough, scientific denoted numbers using + and - used to break because of a mistake I made while parsing them in the tokenizer.
  • The del keyword did not work at all because of a simple mistake

Conclusions
There is no planned updates for awhile unless there is a major bug that I need to patch out immediately. This current version of the language is also updated on the JavaScript side, if you’ve been wondering.

What’s Next?
I have recently been experimenting with transpiling Epoxy code into Lua, for speed. The release of this is not public yet, and it will not be public until I can patch out a lot of issues that it currently has. Let’s just say, every syntax feature so far has been implemented and works as intended for now.

If you find/have any issues/suggestions, let me know