Skip to content

Agents/ascii piet interpreter commands#12

Merged
juner merged 12 commits into
mainfrom
agents/ascii-piet-interpreter-commands
Jun 4, 2026
Merged

Agents/ascii piet interpreter commands#12
juner merged 12 commits into
mainfrom
agents/ascii-piet-interpreter-commands

Conversation

@juner

@juner juner commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

juner and others added 12 commits June 4, 2026 00:25
Adds optional 'language: LanguageType.PietPlusPlus' parameter to
[GeneratePietMethod] attribute (mirrors codelSize), and full runtime
support for the Piet++ esolang extension.

Changes:
- Parser: add LanguageType enum, PietPlusPlusColor helper, and
  TryParse overload that maps pixels to Piet++ colors
- Processor: add PietPlusPlusExecutor with correct command table
  (cmd = DG*16 + DR*4 + DB), stack-of-stacks semantics, and all
  32 Piet++ commands; PietProcessor routes to it when language ==
  LanguageType.PietPlusPlus
- Generator: emit LanguageType enum in the generated attribute type
  so callers can write 'language: LanguageType.PietPlusPlus'; read
  language from attribute arg[2]; dispatch to
  ScanPietPlusPlusIoCommands and PietPlusPlusRuntime in EmitBody;
  generate PietPlusPlusRuntime.g.cs (sync, async, enumerable, async-
  enumerable variants) when needed

All 464 existing tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a new ascii-piet2 text encoding for Piet++ programs (analogous
to ascii-piet for standard Piet), with full parser, formatter,
PietParser integration, and Generator MIME type support.

Character mapping (64 Piet++ color indices):
  ' ' → 0 (Black)  '0'-'9' → 1-10
  'a'-'z' → 11-36  'A'-'Z' → 37-62  '~' → 63 (White)
  '|' → end-of-line marker (actual \r\n are ignored)

New files:
- Parser/AsciiPietPlusPlusParser.cs — TryParse / Parse with codelSize
  and LooksLikeAsciiPietPlusPlus auto-detection
- Parser/AsciiPietPlusPlusFormatter.cs — Format(PietProgram) → string
- Parser.Tests/AsciiPietPlusPlusParserTests.cs — parser and formatter tests

Updated:
- Parser/PietParser.cs — TryParse(language: PietPlusPlus) now routes
  .txt2 / .ascii-piet2 extensions to AsciiPietPlusPlusParser and falls
  back to auto-detection before image parsing
- Generator/MethodGenerator.cs — TryResolveImagePath recognises MIME
  types text/ascii-piet2 and text/ascii-piet-plus-plus → .txt2

All 521 tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Generator MIME: text/ascii-piet2 -> .appp, text/ascii-piet -> .ap
- Add text/ascii-piet++ and text/appp MIME aliases for ascii-piet++ format
- Update doc comments in AsciiPietPlusPlusParser/Formatter: ascii-piet2 -> ascii-piet++
- Update test comments to reflect ascii-piet++ naming

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ormatters

Both AsciiPietFormatter and AsciiPietPlusPlusFormatter now omit trailing Black
(index 0 / PietColor.Black) codels at the end of each row, producing irregular-
width output consistent with the parser's padding-on-read behaviour.

- AsciiPietPlusPlusFormatter: skip trailing ' ' chars; all-Black row emits just '|'
- AsciiPietFormatter: use EOL char variant on last non-Black codel; all-Black row
  emits '@' (Black EndOfLine)
- Added 7 new tests covering trimming, all-Black rows, and round-trip behaviour

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ribute args

Roslyn includes default parameter values in ConstructorArguments, so the
default LanguageType.Piet (0) always overrode the header-based PietPlusPlus
detection from the .piet.txt PIET_LANGUAGE comment.

Fix: only override language from attribute arg when the value is non-default
(non-Piet), i.e. langVal != 0. This ensures that header-based language
detection (PIET_LANGUAGE=PietPlusPlus) takes effect when no explicit
non-default language is specified in the attribute.

Also:
- Fix InternalsVisibleTo assembly name (Piet.Generator.Tests)
- Add TryGetLanguageInt internal helper for testability
- Add dot.appp sample and conformance vector test
- Add diagnostic tests for TryGetLanguageInt and explicit language attribute

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…scii-piet++ support

- Add dotnet-piet colors command to display ascii-piet color table
- Add dotnet-piet colors --piet-plus-plus for ascii-piet++ color table
- Add --piet-plus-plus flag to parse command and root command
- Support .appp/.txt2 extension auto-detection in PietParser.TryParse/Parse
- Add 8 integration tests covering new commands and flags

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Version: 2.0.1
- FileVersion: 2.0.1.7 (incremented build number)
- AssemblyVersion: 2.0.0.0 (unchanged, major-only policy)
- CHANGELOG: move [Unreleased] to [2.0.1] with Piet++ and interpreter additions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@juner juner merged commit 064aa18 into main Jun 4, 2026
11 checks passed
@juner juner deleted the agents/ascii-piet-interpreter-commands branch June 4, 2026 01:51
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