Welcome to LANG X, a pseudocode-based programming tool designed to turn your high-level logic into working JavaScript code. This guide will walk you through creating .xl files and using our CLI to translate them into runnable JavaScript.
Ensure you have the following installed:
- Node.js (v16+ recommended)
-
Clone the LANG X repository:
git clone https://github.com/kel404x/LANG_X.git cd LANG_X -
Install dependencies:
npm install
-
Create a new
.xlfile:touch factorial.xl
-
Add your LANG X pseudocode:
TARGET_LANGUAGE: JavaScript DEFINE FUNCTION main PROMPT: Calculate the factorial of a given number recursively. Input: n (integer) Output: factorial of n
-
Translate your
.xlfile into JavaScript:node src/cli.js factorial.xl output.js
-
Open the
output.jsfile to review the generated code:// Function to calculate factorial recursively function factorial(n) { if (n === 0 || n === 1) { return 1; } return n * factorial(n - 1); } // Main function function main() { let number = 5; // Example input let result = factorial(number); console.log("Factorial of " + number + " is: " + result); } main();
-
Run the JavaScript file:
node output.js
Output:
Factorial of 5 is: 120
-
Missing Input File:
Ensure your.xlfile exists and the path is correct. Example:Error: Source file not found at "path/to/factorial.xl" -
Invalid File Extension:
Only.xlfiles are allowed. Example:Error: Source file must have a .xl extension -
Output Issues:
Ensure your pseudocode follows LANG X conventions for syntax and inputs.
This is a JavaScript-first implementation of LANG X. Contributions are welcome! Feel free to submit pull requests or suggestions for improvements.
This project is licensed under the MIT License. See the LICENSE file for details.