Created
August 27, 2026 16:28
-
-
Save okram/f639c61ace131b8a123936c30973c8cf to your computer and use it in GitHub Desktop.
mtron encoding of a java project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mtron> */usr/marko/scratch.==[name=>_,root=>_,command=>_] | |
| ==>[ | |
| name=>'scratch', | |
| root=>mfs:src/test/resources/scratch, | |
| command=>[ | |
| mvn_build=>/m/ide/inst/command/runner?result<=#{?}(to=>#::T), | |
| mvn_clean=>/m/ide/inst/command/runner?result<=#{?}(to=>#::T), | |
| mvn_exec=>/m/ide/inst/command/runner?result<=#{?}(to=>#::T), | |
| code_tree=>inst?#{*}<=#{?}(max=>isa(int::T).else(2)){*max.split(tree_select::[root=>!*/usr/marko/scratch/root,max=>id(),flatten=>true]@scratch_tree)}]] | |
| mtron> */usr/marko/scratch/code/1.as(web:java::T) | |
| ==>"""package com.example.scratch; | |
| /** | |
| * A simple greeter used as a scratch fixture for the agent IDE. | |
| */ | |
| public class Greeter { | |
| public static final String GREETING = "hello"; | |
| private final String name; | |
| public Greeter(String name) { | |
| this.name = name; | |
| } | |
| /** | |
| * Demonstrates the greeter by printing a greeting. | |
| * | |
| * @param args optional greeting target; defaults to "world" when absent | |
| */ | |
| public static void main(String[] args) { | |
| final String who = args.length > 0 ? args[0] : "world"; | |
| System.out.println(new Greeter("scratch").greet(who)); | |
| } | |
| /** | |
| * Greets a person. | |
| * | |
| * @param who the person to greet | |
| * @return the greeting | |
| */ | |
| public String greet(String who) { | |
| return GREETING + ", " + who + "!"; | |
| } | |
| /** | |
| * The name this greeter was built with. | |
| * | |
| * @return the greeter name | |
| */ | |
| public String name() { | |
| return this.name; | |
| } | |
| } | |
| """ | |
| mtron> */usr/marko/scratch/code/1.as(web:java::T).as(ide:java::T) | |
| ==>java::[ | |
| package=>'package com.example.scratch;', | |
| preamble=>"""package com.example.scratch; | |
| /** | |
| * A simple greeter used a...""", | |
| classes=>[[ | |
| kind=>class_declaration, | |
| name=>'Greeter', | |
| header=>'public class Greeter {', | |
| members=>[ | |
| [ | |
| kind=>field, | |
| text=>""" | |
| public static final String GREETING = "hello";""", | |
| name=>'GREETING'], | |
| [kind=>field,text=>""" | |
| private final String name;""",name=>'name'], | |
| [ | |
| kind=>constructor, | |
| name=>'Greeter', | |
| signature=>'Greeter(String name)', | |
| header=>""" | |
| public Greeter(String name) """, | |
| body=>"""{ | |
| this.name = name; | |
| }""", | |
| footer=>'', | |
| text=>""" | |
| public Greeter(String name) { | |
| this.name = name; | |
| }"""], | |
| [ | |
| [m]enu bar | |
| text=>""" | |
| /** | |
| * Demonstrates the greeter by printing a greeting. | |
| * | |
| ..."""], | |
| [ | |
| kind=>method, | |
| name=>'main', | |
| signature=>'void main(String[] args)', | |
| header=>""" | |
| public static void main(String[] args) """, | |
| body=>"""{ | |
| final String who = args.length > 0 ? args[0] : "world"; | |
| S...""", | |
| footer=>'', | |
| text=>""" | |
| public static void main(String[] args) { | |
| final String who ..."""], | |
| [ | |
| kind=>comment, | |
| text=>""" | |
| /** | |
| * Greets a person. | |
| * | |
| * @param who the person to greet..."""], | |
| [ | |
| kind=>method, | |
| name=>'greet', | |
| signature=>'String greet(String who)', | |
| header=>""" | |
| public String greet(String who) """, | |
| body=>"""{ | |
| return GREETING + ", " + who + "!"; | |
| }""", | |
| footer=>'', | |
| text=>""" | |
| public String greet(String who) { | |
| return GREETING + ", " +..."""], | |
| [ | |
| kind=>comment, | |
| text=>""" | |
| /** | |
| * The name this greeter was built with. | |
| * | |
| * @return t..."""], | |
| [ | |
| kind=>method, | |
| name=>'name', | |
| signature=>'String name()', | |
| header=>""" | |
| public String name() """, | |
| body=>"""{ | |
| return this.name; | |
| }""", | |
| footer=>'', | |
| text=>""" | |
| public String name() { | |
| return this.name; | |
| }"""]], | |
| footer=>""" | |
| }"""]], | |
| postscript=>""" | |
| """] | |
| mtron> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment