Skip to content

feat: Rust target #24

@Mnehmos

Description

@Mnehmos

Overview

Emit Rust code from .nl files.

Command

nlsc compile src/math.nl --target rust
✓ Generated src/math.rs (58 lines)

Type Mapping

NLS Rust
number f64
string String
boolean bool
list of X Vec
CustomType struct CustomType

Challenges

  • Ownership semantics (borrow vs move)
  • Error handling (Result<T, E> vs panic)
  • Guards → Result::Err vs panic!

Implementation

  • Add emit_rust() in emitter.py
  • Generate structs from @type blocks
  • Generate functions from ANLUs
  • Handle guards as Result returns

Exit Criteria

  • Generated Rust compiles with cargo build
  • Idiomatic Rust code (clippy clean)

Metadata

Metadata

Assignees

No one assigned

    Labels

    emitterCode generation targetsenhancementNew feature or requestmulti-targetCross-platform compilation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions