Skip to content

intervinn/abq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABQ

ABQ is a transpiler from Go to Luau heavily inspired by roblox-ts and roblox-cs.

It consists of a Luau AST which mocks the Go's AST, so that the former would easily convert to latter. Then the transformer captures Go's expressions, statements and declaration for it to be converted into Luau analogue.

Limitations

There are some limitations ABQ will aim to implement:

  • Structs are only instantiated as pointers - in Go everything is passed by value, however in Luau the tables are purely reference based.

  • Channels are to be replaced with coroutine polyfills.

  • Every individual package is to be compiled and packed in a single file.

Modding

One call expression will allow pasting any luau string which allows you to port existent Luau code to Go, and it is transform.Mod():

package main

var _ = transform.Mod("local logger = require('logger')")

type Logger struct {}

func NewLogger() *Logger {
	return transform.Mod("logger.new()")
}

func (l *Logger) Log(msg string) {
	transform.Mod("logger.log(l, msg)")
}

Will turn into the following:

local logger = require('logger')
local Logger = {}

function NewLogger()
        return logger.new()
end

function Logger.Log(l,msg)
        logger.log(l, msg)
end

Projects

  • transform - Go AST to Luau AST transformer
  • luau - Luau AST, writer and other essentials
  • transform/pack - Packaging and working with FS
  • cmd/abq - Main CLI

TODO

  • Finish up Transformer and AST
  • Luau libraries polyfills
  • Importing
  • CLI
  • Enhance packing

About

A Go-to-Luau transpiler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published