8000 [Critical] Natural Language Guards Emit Verbatim as Invalid Python · Issue #121 · Mnehmos/mnehmos.nls.lang · GitHub
[go: up one dir, main page]

Skip to content

[Critical] Natural Language Guards Emit Verbatim as Invalid Python #121

Closed

Description

@Mnehmos

Source

NLS Comprehensive Review (Feb 5, 2026) — Section 4

Description

When a guard is written in natural English rather than as a Python expression, the emitter passes it through verbatim, generating invalid Python.

Reproduction

GUARDS:
  - divisor must not be zero -> ValueError("Cannot divide by zero")

Generates:

if not (divisor must not be zero):
    raise ValueError('Cannot divide by zero')

This is a SyntaxError.

Options (Design Decision Required)

  1. Guards are Python expressions only — validate at parse time, reject NL
  2. Guards are NL with a translation layer — build NL-to-Python translator for common patterns (must not be zero -> != 0, must not be empty -> len(x) > 0)
  3. Guards have explicit syntax — e.g., REQUIRE: divisor != 0 for code, GUARD: divisor must not be zero for NL

Review recommends Option 3 as best for NLS's identity.

Current behavior

Silently generating broken Python is the worst option.

Severity

Critical — generates syntactically invalid code without warning

Activity

  1. added
    bugSomething isn't working
    coreCore language semantics and design
    emitterCode generation targets
    on Feb 6, 2026
  2. Mnehmos commented on Feb 8, 2026

    @Mnehmos
    OwnerAuthor

    Resolved by merge of PR #127.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreCore language semantics and designemitterCode generation targetspriority-criticalMust be addressed immediately

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0