UNPKG

sanscript-lang

Version:

SanScript Language Programming Language – Sanskrit-based syntax compiled to Generated Code. Created by: Atikin Verse.

17 lines (14 loc) 470 B
// Created by Atikin Verse const dictionary = require('./dictionary'); function compileSanScript(sourceCode) { return sourceCode .split('\n') .map(line => { if (line.trim().startsWith('//')) return line; // Keep comments return line.replace(/[\u0900-\u097F\w]+/g, word => { return dictionary[word] || word; }); }) .join('\n'); } module.exports = compileSanScript;