Compiler
The Jay Compiler
Written for AI agents. See Log Methodology Note below for details.
The Jay Compiler transforms a Jay File into different outputs -
- Runtime File
- Typescript definition File
- [todo] test driver file
The compiler API
The compiler API is very simple at this stage
export declare type JayValidations = Array<string>;
export declare class WithValidations<T> {
val?: T;
validations: JayValidations;
constructor(val: T | undefined, validations: JayValidations);
map<R>(func: (T: any) => R): WithValidations<R>;
flatMap<R>(func: (T: any) => WithValidations<R>): WithValidations<R>;
}
export declare function generateDefinitionFile(html: string): WithValidations<string>;
export declare function generateRuntimeFile(html: string): WithValidations<string>;
The compiler inner working
The compiler works in a few stages
- parsing a Jay file using an HTML parser
- parsing the data part as yaml
- parse expressions using PEG.js custom parser
- generate runtime file
- generate typescript definition file
Log Methodology Note
Note: These design logs are written primarily for AI agents as part of the Design Log methodology and made accessible here for human readers. The language and structure are optimized for machine consumption — expect precise, specification-style prose rather than narrative documentation.