[ERLScript] - Interpreted lua-like programming language

ERLScript is a programming language designed to be easily executed in roblox, being decently customizable & able to be ran multiple times in a single script. Please expect bugs, as this is a new type of project for me, and has been done in my free time.

Github Reposititory - Latest Release - Wiki

ERLScript takes syntax from both lua & javaScript, as they are both some of my favourite programming languages to use.

ERLScript also includes a math library in the global scope, which has all luau math functions included.

Example script utilizing ERLScript:

local ERL = require("path.to.ERLScript")
local runTime = ERL.runTime(ERL.runTimeSettings())

-- Hello from ERLScript!
runTime:execute([[
    print("Hello from ERLScript!")
]])

-- Example for loop, these are done differently from lua & javaScript.
-- Lua equivalent: for index, value in ipairs({1, 2, 3, 4, 5}) do print(index, value) end
runTime:execute([[
    for (name, value, index) ({1, 2, 3, 4, 5}) {
        print(name, value, index)
    }
]])

-- ERLScript supports functions! Even anonymous functions are supported!
runTime:execute([[
    function add(a, b) {
        return a + b
    }
    print(add(10, 5))
    print(function(a, b) {a % b})
]])

There currently isn’t any documentation for ERLScript yet, but once I create a github repo for the language, I will link it in this post and add some documentation to the repo.

In the future I plan to:

  • Create proper error handling and add references to the current line and token in the AST nodes.
  • Add rules you can add to the runtime settings to limit what users can do (for limiting instance edits, creations, and certain functions)
  • Possibly allow for even easier customization of the language using custom lexer tokens, custom parse logic, and custom AST nodes along with ways to execute them. (this one might not be implemented)

Don’t expect many updates for this module, as I am currently working on other projects (such as my game) and might end up completely forgetting about this project.

6 Likes

UPDATE 1.1!

Changelog:

  • Custom iterator functions in for loops are now possible!
    Example usage:
function tableIterator(tableQuery) {
	var entries = table.entries(tableQuery)
	var index = 0

	return function () {
		index += 1
		if (index <= table.len(entries)) {
			var entry = entries[index]
			var tableEntity = tableQuery[entry]
			return {entry, tableEntity, index}
		}
	}
}

for (name, value, index) (tableIterator({32,56,11,21,10})) {
	print(name, value, index)
}
  • Return statements are fixed and actually stop functions.
  • Fixed a dozen small mistakes littered throughout the code.
  • Table library! Current functions implemented are: [clear, clone, concat, find, insert(table, value, position?), parameters(function, parametersArray, …extraParameters), entries(table), len(table)]
  • VERSION global which reports what version the language is at, similar to luau’s _VERSION global.
1 Like

For some reason Roblox has moderated the model, so for now you cannot use it. I am quite sure Roblox will just reply with a template denying the appeal, so I might end up having to re-upload the asset.

Upload it to github instead, roblox loves to ruin everything recently

2 Likes

Yeah I might just have to do that

UPDATE v1.1.1!

Changelog:

  • While & for loop error logic fixed
  • Added extra checks to break & return statement parsing
  • Created a wiki on github (along with the repository, you can view both of these in the topic post)
  • You should no longer use the roblox model to install the module, roblox has moderated this for no reason, which is partly why I switched to providing the module on github.

UPDATE 1.2!

  • Added CFrame, Vector3, Vector2, UDim2, UDim, and Color3 datatypes to the language. (Some of these still don’t have libraries to go with them)
  • Support for modifying and reading from Instances! (instance functions use DOT)
  • workspace global
  • game global
  • Instance library
  • requireLUA(input: string | number | instance) - runs luaus require() and converts it into an ERLScript table.
  • runTimeSettings.allowInstances
  • runTimeSettings.allowRequireLua
  • various fixes
2 Likes