Add translator to poyo

This commit is contained in:
2025-05-16 11:27:16 +02:00
parent 871f46b996
commit f83f59c05a
10 changed files with 424 additions and 410 deletions

View File

@@ -1,6 +1,24 @@
using System.Text;
namespace PoyoLang.Translator;
public partial class PoyoLangTranslator
{
public string TranslateToPoyo(ReadOnlySpan<char> text)
{
var output = new StringBuilder(text.Length);
while (text.Length > 0)
{
NextLetter(ref text, output);
// Add space if not reached the end
if (text.Length > 0)
{
output.Append(' ');
}
}
return output.ToString();
}
}