Transliterate English text using the Greek alphabet: Difference between revisions

m
→‎{{header|Phix}}: looks a bit better with constant first
m (→‎{{header|Phix}}: looks a bit better with constant first)
Line 157:
<!--<lang Phix>(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">functionconstant</span> <span style="color: #000000;">rulestask</span> <span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000008000;">task</span><span style="color: #0000FF;">)</span>"
alpha a
beta b or v
gamma g
delta d
epsilon e (but not ee)
zeta z
eta h or ee (but not ch, kh, ph, rh or th)
theta th
iota i or j
kappa c, k, q or ck (but not ch and kh)
lambda l
mu m
nu n
xi x
omicron o (but not oo)
pi p (but not ph or ps)
rho r or rh
sigma s (but not ps)
tau t (but not th)
upsilon u or y
phi f or ph
chi ch or kh
psi ps
omega w or oo
"""</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">rules</span><span style="color: #0000FF;">()</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">replacements</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">split</span><span style="color: #0000FF;">(</span><span style="color: #000000;">task</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\n"</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">,</span><span style="color: #000000;">s</span> <span style="color: #008080;">in</span> <span style="color: #000000;">replacements</span> <span style="color: #008080;">do</span>
Line 196 ⟶ 223:
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">constant</span> <span style="color: #0000000000FF;">task{</span><span style="color: #000000;">sub</span><span style="color: #0000FF;">,</span><span style="color: #000000;">rep</span><span style="color: #0000FF;">}</span> <span style="color: #0080000000FF;">=</span> <span style="color: #000000;">rules</span><span style="color: #0000FF;">(),</span>
alpha a
beta b or v
gamma g
delta d
epsilon e (but not ee)
zeta z
eta h or ee (but not ch, kh, ph, rh or th)
theta th
iota i or j
kappa c, k, q or ck (but not ch and kh)
lambda l
mu m
nu n
xi x
omicron o (but not oo)
pi p (but not ph or ps)
rho r or rh
sigma s (but not ps)
tau t (but not th)
upsilon u or y
phi f or ph
chi ch or kh
psi ps
omega w or oo
"""</span><span style="color: #0000FF;">,</span>
<span style="color: #0000FF;">{</span><span style="color: #000000;">sub</span><span style="color: #0000FF;">,</span><span style="color: #000000;">rep</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">rules</span><span style="color: #0000FF;">(</span><span style="color: #000000;">task</span><span style="color: #0000FF;">),</span>
<span style="color: #000000;">gulp</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">utf8_to_utf32</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"</span><span style="color: #0000FF;">&</span>
<span style="color: #008000;">"αβγδεζηθικλμνξοπρστυφχψω ,.\n"</span><span style="color: #0000FF;">),</span>
7,806

edits