Skip to content

docs: add C ABI & name mangling specification#23

Merged
thiremani merged 2 commits intomasterfrom
docs/c-abi-spec
Jan 1, 2026
Merged

docs: add C ABI & name mangling specification#23
thiremani merged 2 commits intomasterfrom
docs/c-abi-spec

Conversation

@thiremani
Copy link
Copy Markdown
Owner

Summary

Add comprehensive specification for Pluto's C ABI and name mangling scheme.

Key features:

  • Symbol templates for functions, methods, operators, and constants
  • Length-prefixed identifiers (e.g., 6github = "github")
  • Separator codes (d/s/h for .///-) with canonicalization
  • Numeric segments for versions (e.g., n2 for "2")
  • Structure markers (fN, m, p, tN, op, fixity)
  • Operator codes (add, sub, mul, div, eq, neq, etc.)
  • Type mangling (primitives, qualified types, generics)
  • SRET calling convention with pass-by-reference semantics
  • Formal EBNF grammar

Design goals:

  • Bijective (lossless) encoding
  • C/C++ compatible (no __ sequences)
  • Self-describing structure via markers

Test plan

  • Review specification for completeness
  • Verify examples are correct
  • Check grammar matches described rules

🤖 Generated with Claude Code

thiremani and others added 2 commits January 1, 2026 18:33
Add comprehensive specification for Pluto's C ABI including:
- Symbol templates for functions, methods, operators, constants
- Length-prefixed identifier encoding
- Separator codes (d/s/h for .//-) with canonicalization rules
- Numeric segment encoding for versions
- Structure markers (fN, m, p, tN, op, in/pre/suf/cirN)
- Operator codes (add, sub, mul, etc.)
- Type mangling (primitives, qualified, generics)
- SRET calling convention with pass-by-reference
- Formal EBNF grammar

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Arity := Num to complete the grammar
- Add Num := '0' | [1-9][0-9]* rule (no leading zeros)
- Apply Num to NumericSeg, Arity, and cirN fixity
- Add note explaining Num rule applies to all numeric suffixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@thiremani thiremani merged commit 2cae78b into master Jan 1, 2026
2 checks passed
@thiremani thiremani deleted the docs/c-abi-spec branch January 1, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant