NLS - Natural Language Source

The source code is English. The compiled artifact is Python.
Language support for NLS (Natural Language Source) specification files in Visual Studio Code.
Features
Syntax Highlighting
Full syntax highlighting for .nl files including:
- Directives -
@module, @version, @target, @imports
- ANLU blocks -
[function-name] with PURPOSE, INPUTS, GUARDS, LOGIC, RETURNS
- Type definitions -
@type, @invariant
- Test blocks -
@test, @property
- Comments - Line comments with
#
Code Snippets
Quickly scaffold NLS constructs:
| Prefix |
Description |
anlu |
Full ANLU function block |
type |
Type definition |
test |
Test block |
prop |
Property-based test |
inv |
Type invariant |
module |
Module header |
guard |
Guard clause |
Diagnostics
Real-time validation powered by the nlsc compiler:
- Syntax errors
- Undefined dependencies
- Type mismatches
- Invalid guards
Commands
- NLS: Compile File - Compile the current
.nl file to Python
- NLS: Verify File - Validate syntax without compiling
- NLS: Run Tests - Execute
@test blocks
Requirements
Install the NLS compiler:
pip install nlsc
Quick Start
- Create a new file with
.nl extension
- Start with a module directive:
@module calculator
@target python
[add]
PURPOSE: Add two numbers
INPUTS:
- a: number
- b: number
RETURNS: a + b
- Run NLS: Compile File to generate Python code
Links
License
MIT
| |