ngls
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

NGLS - Natural General Language Syntax

Build Status NPM version

A natural language layer on top of GLS.

General Language Syntax (GLS) is a unified syntax that compiles into a number of OOP languages. NGLS converts natural language to GLS syntax, which can then be converted into real code.

NGLS GLS JavaScript
Comment that this is an awesome project comment line : This is an awesome project // This is an awesome project
Gimme a for loop for i from 0 to 10 pls for numbers start : i number 0 10 for (let i = 0; i < 10; i++) {
How about an int named count equal to 7 variable : count int 7 let count = 7;

Usage

(coming soon!)

Development

NGLS 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
gulp

To build, run gulp. You can build+lint the souce without running tests using gulp src, or just build+lint+run tests using gulp test. The full list of tasks is in gulpfile.js.

Alternately, use tsc to build source files under /src to /lib, and tsc -w to build upon file changes.

Commands

Each supported GLS command needs a matchers.ts exporting a MatchersList and a command.ts exporting a Command.

MatchersList

Each command's MatchersList tests whether input strings can be converted to that GLS. If the string can, a string[] of matches from the test is converted to an object satisfying that command's ICommandArgs.

For each list of tests, the first matching test (if any) will be used. Testers satisfy the IMatchTest interface and are typically implemented with a regular expression.

Command

A command takes in a settings object and converts it to lines of GLS and/or recursive NGLS command, as one string[] per line. Recursive NGLS commands must start with "{ " and end with " }".

Tests

Integration tests are done using BDD. Folders under /test/integration will contain a source.txt file with raw text source and an expected.txt file with the expected output. These are verifified during gulp test:integration.

Package Sidebar

Install

npm i ngls

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • joshuakgoldberg