/** * Framework ↔ Semantic bridge builders. * * Pure functions that combine an injected {@link GrammarProfileSlice} (the * per-language grammar facts, typically a `@lokascript/semantic` * `LanguageProfile`) with a {@link DomainVocabulary} (the only thing a domain * authors per language) into the shapes `createMultilingualDSL` consumes: * a `PatternGenLanguageProfile`, a `LanguageTokenizer`, or a complete * `LanguageConfig`. */ import type { LanguageTokenizer } from '../core/types'; import type { PatternGenLanguageProfile } from '../generation/profile'; import type { LanguageConfig } from '../api/create-dsl'; import type { LanguageProfile as GrammarProfile } from '../grammar'; import { type ValueExtractor } from '../interfaces/value-extractor'; import type { DomainVocabulary, GrammarProfileSlice } from './types'; /** * Build a pattern-generation profile: domain keywords + slice grammar * (word order, role markers). The result feeds `LanguageConfig.patternProfile` * and the schema renderer. */ export declare function buildPatternProfile(slice: GrammarProfileSlice, vocab: DomainVocabulary): PatternGenLanguageProfile; /** Options for {@link buildDomainTokenizer}, overriding the slice-derived defaults. */ export interface DomainTokenizerOptions { /** * Recognize operator tokens (default: false, matching `createSimpleTokenizer`). * Domains whose grammar contains operators (e.g. SQL's `WHERE age > 18`) pass * `true`; most natural-language DSLs leave it off. */ readonly includeOperators?: boolean; /** * Case-insensitive keyword matching. Defaults to true for bicameral scripts * (`latin`, `cyrillic`, or when the slice omits `script`), false otherwise. */ readonly caseInsensitive?: boolean; /** Extra extractors, registered before the slice-derived ones */ readonly customExtractors?: readonly ValueExtractor[]; } /** * Build a domain tokenizer from a grammar slice + domain vocabulary, wrapping * `createSimpleTokenizer`. Derived from the slice: * * - `direction` (rtl for e.g. Arabic/Hebrew slices) * - keyword set: vocabulary verbs (primary + alternatives), role markers * (slice defaults merged with `vocab.roleMarkerOverrides`), tokenization * particles, and `vocab.tokenizerKeywords` * - keyword-normalization profile (native verb → action name, marker → role) * - a `LatinExtendedIdentifierExtractor` when `slice.script === 'latin'`, so * diacritics (ñ, é, ş, …) never split identifiers * - case-insensitivity for bicameral scripts */ export declare function buildDomainTokenizer(slice: GrammarProfileSlice, vocab: DomainVocabulary, options?: DomainTokenizerOptions): LanguageTokenizer; /** Metadata / overrides for {@link buildLanguageConfig}. */ export interface LanguageConfigMeta { /** English name (default: `slice.name`, falling back to `slice.code`) */ readonly name?: string; /** Native name (default: `slice.nativeName`, falling back to the English name) */ readonly nativeName?: string; /** Grammar-transformation profile to attach (optional, as on `LanguageConfig`) */ readonly grammarProfile?: GrammarProfile; /** Use this tokenizer instead of the slice-derived one */ readonly tokenizer?: LanguageTokenizer; /** Options for the slice-derived tokenizer (ignored when `tokenizer` is given) */ readonly tokenizerOptions?: DomainTokenizerOptions; } /** * The one-call path into `createMultilingualDSL`: build a complete * `LanguageConfig` (tokenizer + pattern profile + names) from a grammar slice * and a domain vocabulary. */ export declare function buildLanguageConfig(slice: GrammarProfileSlice, vocab: DomainVocabulary, meta?: LanguageConfigMeta): LanguageConfig; /** * Derive schema `markerOverride` defaults for ONE language from the slice's * role markers, given a domain-role → semantic-role mapping. Returns * `{ domainRole: primaryMarker }` with entries only where the slice has a * marker for the mapped semantic role. * * ```ts * deriveRoleMarkers(jaSlice, { table: 'source', target: 'destination' }); * // → { table: 'から', target: 'に' } * ``` * * Explicitly authored `markerOverride` entries stay authoritative — when * assembling a per-language marker map for a schema role, spread the explicit * entries after the derived defaults. */ export declare function deriveRoleMarkers(slice: GrammarProfileSlice, roleMapping: Readonly>): Record; //# sourceMappingURL=builders.d.ts.map