TypeScript JavaScript Java C# Python Ruby Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src JavaScript Support (#181) Dec 13, 2016
.gitignore Various build process improvements (#118) Sep 13, 2016
CONTRIBUTING.md Removed "next" branch mention from CONTRIBUTING.md Feb 18, 2017
Contributors.md Fixed typo around do start/while link Dec 13, 2016
README.md Added async/await to unsupported feature list (#200) Feb 18, 2017


GLS - General Language Syntax

Build Status NPM version

A unified syntax that compiles into a number of OOP languages. Play with the demo at aka.ms/gls-demo.


npm install general-language-syntax

const Gls = require("general-language-syntax").Gls;

const gls = new Gls();

// System.Console.WriteLine("Hello world!");
console.log(gls.convert([`print : ("Hello world!")`]));


Most object-oriented programming languages today are "pretty much" the same. Declaring variables, PEMDAS operations, calling functions, and so on rarely change; the base concept of a compiled or scripting language with managed memory is very common.

GLS provides a common syntax to describe programming functionality in these common managed languages. .gls files can be compiled into any of the supported languages, and will work approximately the same in all of them.


Each line in GLS consists of a function, a colon, and any number of arguments, all separated by spaces.

print : "GLS!"
  • Function: print
  • Argument: "GLS!"

print : GLS will compile to System.Console.WriteLine("GLS!"); in C#, console.log("GLS!"); in TypeScript, and so on.


You can keep spaces inside your arguments by wrapping characters in parenthesis. This tells the compiler to treat the space as part of the argument instead of a separator.

print : ("Hello world!")
  • Function: print
  • Argument: "Hello world!"


To pipe the output of one command into another, wrap the inner command with {} brackets.

print : { operation : 1 plus 2 }


  • Each GLS command is independent - it doesn't know or care about any preceding or following commands.


GLS is halfway between 0.3 and 0.4.

Deliverable Version Description
C++ Compiler 0.1 Command-line GLS prototype, written in C++.
TypeScript Compiler draft 0.2 GLS compiler as a website, written in TypeScript.
TypeScript Compiler + C# Output 0.3 GLS compiler re-written in TypeScript, with correct TypeScript and C# output.
Dogfood Feature Complete 0.4 All features expected to be required for dogfooding implemented. Java, JavaScript, Python, and Ruby support.
Dogfood 0.5 Compiler written in GLS code, working in C#, Java, JavaScript, Ruby, Python, and TypeScript.
Powershell, PHP, Objective-C, Misc. 0.6 Dogfood or reject those languages and other possibilities.
Language Specification Finalized 0.7 Finalized language spec & cleaned internals of code.
General Release 1.0 Public announcement, glory to everyone.

Intentionally Missing Items

No language is perfect. The following are some seemingly obvious omissions in GLS that are due to languages not supporting them:

Feature C# Java Python Ruby (Java|Type)Script
`async`/`await`! Missing Missing
Default Member Variable Values Missing
Do/While Loops Missing
Enums Without Values Missing
Multiline Lambdas Missing
Optional Parameters Missing
Overloaded Functions Missing Missing Missing
String.Replace Abnormal
Switch Statements Missing

This list will grow as features are requested.

Intentionally Unsupported Languages

Not all languages work similarly to the supported ones. These will likely never receive GLS support, for the following common reasons (among others):

Language Manual Pointers Unusual Classes
C++ ✓ (#190)

This list will grow as languages are requested.


GLS uses Gulp to automate building, which requires Node.js.

To build from scratch, install Node.js and run the following commands:

npm install -g gulp
npm install

To build, run gulp. You can build without running tests using gulp build, or just run tests using gulp test.


Integration and end-to-end tests are done using BDD. Folders under /test/integration and /test/end-to-end will contain a .gls file with GLS source code along with text files of the expected output in supported languages. These are verifified during gulp test.

You can run specific tests using their gulp task (gulp test:integration or gulp test:end-to-end), and individual test groups using --command (gulp test:end-to-end --command arrays).