@@ -174,19 +174,16 @@ def get_async_reproduction_prompt(spec: str, fmt: str, file_name: str, with_test
174174 return prompt
175175
176176
177- def get_token_reproduction_prompt (spec : str , fmt : str , file_name : str ) -> str :
177+ def get_token_reproduction_prompt (spec : str , fmt : str , file_name : str , language : str = "python" ) -> str :
178178 format_hints = {
179179 "json" : "Parse the JSON structure and implement all classes and functions." ,
180180 "json_compact" : "Parse the compact JSON and implement all elements." ,
181181 "yaml" : "Parse the YAML structure and implement all classes and functions with exact signatures." ,
182- "gherkin" : "Implement scenarios as SIMPLE, MINIMAL Python code. NO extra error classes, NO over-engineering. Keep code short and direct." ,
182+ "gherkin" : "Implement scenarios as SIMPLE, MINIMAL code. NO over-engineering. Keep code short and direct." ,
183183 "markdown" : "Parse embedded Gherkin (behaviors) and YAML (structures)." ,
184- "logicml" : """Parse LogicML and generate VALID Python code:
185- - 'sig: (params) -> Type' = def func(params) -> Type
186- - 'sig: async (params)' = async def func(params)
187- - 'sig: @property (self)' = @property decorator
188- - 'bases: [BaseModel]' = class X(BaseModel) with Field()
189- - 'type: re-export' = from .module import X
184+ "logicml" : """Parse LogicML and generate VALID code:
185+ - 'sig:' lines describe function signatures (translate to the target language)
186+ - 'type: re-export' means this module primarily re-exports symbols
190187CRITICAL: Ensure valid syntax - balanced brackets, proper indentation, no undefined variables.""" ,
191188 "toon" : """Parse TOON (Token-Oriented Object Notation) format carefully:
192189
@@ -211,17 +208,30 @@ def get_token_reproduction_prompt(spec: str, fmt: str, file_name: str) -> str:
211208 max_spec = 5000
212209 spec_truncated = spec [:max_spec ] if len (spec ) > max_spec else spec
213210
214- prompt = f"""Generate Python code from this { fmt .upper ()} specification.
211+ language_norm = (language or "python" ).strip ().lower ()
212+ lang_label_map = {
213+ "python" : "Python" ,
214+ "javascript" : "JavaScript" ,
215+ "typescript" : "TypeScript" ,
216+ "go" : "Go" ,
217+ "rust" : "Rust" ,
218+ "java" : "Java" ,
219+ "csharp" : "C#" ,
220+ "sql" : "SQL" ,
221+ }
222+ lang_label = lang_label_map .get (language_norm , language_norm )
223+
224+ prompt = f"""Generate { lang_label } code from this { fmt .upper ()} specification.
215225{ format_hints .get (fmt , '' )}
216226
217227{ spec_truncated }
218228
219229Requirements:
220- - Complete, working Python code for { file_name }
230+ - Complete, working { lang_label } code for { file_name }
221231- Include imports and type hints
222232- Implement all functions with actual logic
223233
224- ```python
234+ ```{ language_norm }
225235"""
226236 return prompt
227237
0 commit comments