Add Premake language definition
Add Premake as a separate language (premake5.lua)
Description
Premake is a quite popular Lua-based build configuration tool used extensively in the C++ community.
Currently premake5.lua files are classified as generic Lua, which significantly distorts language statistics for many repositories.
This PR adds Premake as a distinct language with its canonical filenames, official brand color, and a heuristic.
Example of a notable project using Premake:
- Hazel Engine (12.7k stars, 1.6k forks) - Game engine by The Cherno, widely used as a learning resource in the C++ community
Official links:
-
Repository: https://github.com/premake/premake-core
-
Website: https://premake.github.io/
Real World examples: Source: https://github.com/TheCherno/glfw/blob/9bed794ab7c1b961aaca259403695bbd3870d3b3/premake5.lua License: zlib/libpng (GLFW)
Checklist:
-
[x] I am adding a new language.
-
[x] The extension of the new language is used in hundreds of repositories on GitHub.com.
-
Search results for each extension:
- premake5.lua: https://github.com/search?q=path%3A**%2Fpremake5.lua+-is%3Afork&type=code
-
-
[x] I have included a real-world usage sample for all extensions added in this PR:
- Sample source(s): premake5.lua:
-
workspace "MyWorkspace"
configurations { "Debug", "Release" }
project "MyProject"
kind "ConsoleApp"
language "C++"
files { "**.h", "**.cpp" }
filter { "configurations:Debug" }
defines { "DEBUG" }
symbols "On"
filter { "configurations:Release" }
defines { "NDEBUG" }
optimize "On"
Source: https://premake.github.io/docs/What-Is-Premake
License: BSD-3-Clause (Premake documentation)
-
[x] I have added a color
-
Hex value: #e67e22
-
Rationale: one of Premake's Official Brand Colors, used in the logo
-
-
[x] I have updated the heuristics to distinguish my language from others using the same extension.
- Matches Premake-specific top-level keywords while avoiding false positives on regular Lua scripts
In my projects, as in many others, GitHub's language statistics give the impression that a significant portion of the code is written in Lua, especially if the project has multiple premake-files, when in fact these are just premake files. This PR helps distinguish premakes from regular Lua.
I'm don't think this should be pulled out into it's own entry as Premake appears to be a build system, like Bazel, that is written in Lua and not it's own language. We don't have a specific entry for Bazel as it's not a language. Instead it is included in Starlark which is the language Bazel uses.
Build systems are essentially like a framework written in another language. We don't add support for frameworks as that's not the language, hence we don't have support for React or Rails or Phoenix or any other framework.
Hey @lildude, thanks a lot for the quick review!
I totally understand the reasoning about build systems vs languages — Bazel → buildSystem, CMake → buildSystem, C++ → Lang, etc.
One important distinction: frameworks like React, Rails, or Phoenix are libraries used inside an existing language. Premake is not a library — it is a DSL-based build configuration system with a canonical filename, just like CMake, Meson, and Ninja.
Premake is a bit of a special case, and that’s why I opened this PR:
1. Filename-based, not extension-based
Premake files are always named exactly premake5.lua or premake4.lua (never .premake, never arbitrary filenames). This is not a generic Lua script — it's the canonical entry point, just like CMakeLists.txt is for CMake.
2. CMake has been a separate language since 2012
CMake is also “just a build system with its own DSL”, yet it has its own entry, color, ~~and heuristics~~. The same logic has been applied to Meson, Ninja, Buck, etc.
3. Massive distortion of statistics
- TheCherno/Hazel (12.7k) shows 2.3% Lua — 100% of that comes from the premake5.lua file.
- My own project (~~FrameLog~~) shows 18% Lua — again, 100% of that is Premake files.
- Thousands of C++ GitHub repositories show 5–35% “Lua” purely because of Premake.
This is exactly the same statistical problem that the CMake entry solved years ago.
4. Zero risk
The heuristic is extremely strict (matching top-level Premake-specific keywords like workspace, project, kind, cppdialect, include, etc.) and only applies to the two canonical filenames.
5. Avoiding misleading interpretations
Lua appearing in statistics makes some users assume the project requires an embedded Lua runtime or that part of its logic is written in Lua, which is not the case. This is a common source of confusion for C/C++ repositories.
Additionally, one of Linguist’s core principles is to avoid skewed language statistics. Leaving Premake unrecognized distorts statistics for a very large number of repositories in the C/C++ ecosystem.
This is literally the same precedent as CMake — just 13 years later.
I’d be happy to adjust anything needed, but I believe this fits very cleanly into Linguist’s existing policy for configuration-oriented DSLs with canonical filenames.
Thanks again for considering!
Thank you @lildude!
I've made all the necessary edits:
- Removed the heuristics section (not needed for filename-based detection)
- Removed the interpreters section (premake files don't use shebangs)
- Added real-world samples for both premake4.lua and premake5.lua with sources and licenses
Ready for review!
Hey @lildude, just wanted to check if there’s anything else needed from my side to get this PR merged? All requested edits have been applied and real-world samples added. Thanks!
Hey @lildude, I think I've made all the required changes.
I deleted premake4.lua because it's long outdated and hard to find a real example.
I also added a real-world premake5.lua example with source and license, and updated vendor/grammars/README.md with a link to it.
You've not resolved the ordering test failure.
I hope I fixed it now?
I hope I fixed it now?
Nope. The entry needs to be in alphabetic order.
It's in alphabetical order, isn't it? Something happened with my git, and the commits got mixed up for some reason. I rebased it and it seems to have fixed everything.
Look again, when you looked there, the commits were mixed up (and first five commits ended up at the top in reverse order and broke everything). It should be correct now.
Ready for review!
I've removed premake4.lua because it is outdated.
I’ve also added a real-world premake5.lua example with source code and a license, and updated vendor/README.md using a script.
Everything is now in alphabetical order.
Everything is now in alphabetical order.
It's not. If you run the tests you'll see it'll still fail. The section needs to go after Praat.