// CUE code for defining the DSL package shenikan // Generate json output via `cue export -p shenikan` import "strings" _#ShortDefinition: string _#LongDefinition: {[string]: string} _#AnyDefinition: _#ShortDefinition | _#LongDefinition _#RawDefinition: _#AnyDefinition | [..._#AnyDefinition] | *"" _dictionary: { glyphs: vowel: [Orthography=_]: [...#VowelAttribute] | *null glyphs: cluster: [Orthography=_]: [...#ClusterAttribute] | *null glyphs: punctuation: [Orthography=_]: [...#PunctuationAttribute] | *null glyphs: numeric: [Orthography=_]: [...#NumericAttribute] | *null dialects: [Name=_]: [Old=_]: string _#DMDSL: {[#PartOfSpeech]: _#RawDefinition} dms: [Orthography=_]: _#DMDSL dmPentas: [Orthography=_]: { name?: string extremes: {i?: string, u?: string} for v in _vowels {"\(v)": _#DMDSL | *null} } dms: { for o, dmPenta in dmPentas { for v in _vowels let ortho = strings.Replace(o, " ", v, 1) if dmPenta["\(v)"] != null { (ortho): dmPenta["\(v)"] } } } #Derivable: from?: [string]: via: string | [...string] _#WordDSL: {[#PartOfSpeech]: _#RawDefinition, #Derivable} words: [Orthography=_]: _#WordDSL _#PentaDSL: { name?: string extremes: {i?: string, u?: string} for v in _vowels {"\(v)": _#WordDSL | *null} #Derivable } pentas: [Orthography=_]: _#PentaDSL words: { for o, penta in pentas { for v in _vowels let ortho = strings.Replace(o, " ", v, 1) if penta["\(v)"] != null { (ortho): penta["\(v)"] & { if penta.from != _|_ { from: { for r, v in penta.from { (ortho): v } } } } } } } icosas: [Orthography=_]: { name?: string extremes: {ix?: string, ux?: string, xi?: string, xu?: string} for v1 in _vowels for v2 in _vowels { "\(v1)\(v2)": _#WordDSL } for v in _vowels { "\(v)x": string "x\(v)": string } #Derivable } pentas: { for o, icosa in icosas { for v in _vowels { (strings.Replace(o, " ", v, 1)): { if icosa["\(v)x"] != _|_ {name: icosa["\(v)x"]} extremes: { if icosa.extremes.xi != _|_ {i: icosa.extremes.xi} if icosa.extremes.xu != _|_ {u: icosa.extremes.xu} } } let o1 = strings.Replace(o, " ", "~", 1) let o2 = strings.Replace(o1, " ", v, 1) (strings.Replace(o2, "~", " ", 1)): { if icosa["x\(v)"] != _|_ {name: icosa["x\(v)"]} extremes: { if icosa.extremes.ix != _|_ {i: icosa.extremes.ix} if icosa.extremes.ux != _|_ {u: icosa.extremes.ux} } } } } } words: { for o, icosa in icosas { for v1 in _vowels for v2 in _vowels let ortho = strings.Replace(strings.Replace(o, " ", v1, 1), " ", v2, 1) if icosa["\(v1)\(v2)"] != null { (ortho): icosa["\(v1)\(v2)"] & { if icosa.from != _|_ { from: { for r, v in icosa.from { (ortho): v } } } } } } } }