lncc
v1.0.0
Published
Create a typed language with ease!
Maintainers
Readme
🔤 lncc - Language Node Compiler
lncc is a framework for creating and running your own domain-specific programming languages on top of JavasScript. It allows you to define custom syntax, keyword replacements, and even package handling.
🚀 Features
- 🧠 Simple keyword-to-JS translation (e.g.,
print → console.log) - 📦 Auto-import (and auto-install) external packages
- 📁 Custom language file extensions (e.g.,
.dsl) - 🛠️ Pluggable and scriptable language behavior
- 🎛️ CLI support for initializing and running projects
📦 Installation
npm install -g lncc🛠️ Getting Started
1. Initialize a Project
lncc initCreates:
lncc.package.json– project manifestlncc.config.js– language definition configindex.dsl– your DSL entry point
2. Define Your Language (lncc.config.js)
const { createLanguage } = require("../");
module.exports = new createLanguage({
name: "MyLang",
extension: ".dsl",
replacements: [
['v', 'const'],
['print', 'console.log']
],
packages: [
['express', 'express']
]
});📄 Example DSL (index.dsl)
v app = express();
app.listen(300, () => {
print("API running on port 3000");
});▶️ Run Your Language
lnccThis will parse your DSL, replace keywords, install required packages, and execute the code.
📁 lncc.package.json Format
{
"name": "example",
"main": "index.dsl",
"packages": {
"express::express": "5.1.0"
}
}📚 API: createLanguage(config)
name: Name of the language.extension: Custom file extension for your language files.replacements: List of[customSyntax, jsSyntax]keyword pairs.packages: Optional list of[customName, nodeModule]for auto-import and install.
✅ License
MIT
