Learn Thue - 10 Code Examples & CST Typing Practice Test
Thue is an abstract computational model based on string rewriting systems. It allows defining rules to transform strings, serving as a theoretical model for computation and a framework for exploring universal computation.
Learn THUE with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
Hello World in Thue
::=
::=Hello World!
::=::
A simple Thue program that outputs 'Hello World!'. The rules transform an initial start symbol into the target string.
Simple Increment
N::=0
N::=N1
N::=N2
N::=N3
N::=N4
N::=N5
N::=N6
N::=N7
N::=N8
N::=N9
Increment a number represented as a string of digits.
Simple Decrement
D1::=0
D2::=1
D3::=2
D4::=3
D5::=4
D6::=5
D7::=6
D8::=7
D9::=8
D0::=9
Decrement a number represented as a string of digits.
Print Numbers 1 to 3
S::=1A
A::=2B
B::=3
C::=::
S
Prints numbers 1, 2, 3 sequentially using Thue rules.
Conditional Output Example
S::=A?YES:NO
A::=::
S
Outputs 'YES' if symbol A exists, 'NO' otherwise.
Palindrome Check
S::=ABA
ABA::=PALINDROME
B::=::
S
Checks if a string is a palindrome using Thue transformations.
Factorial Concept
F::=1
F::=F*2
F::=F*3
F::=F*4
F::=RESULT
RESULT::=::
F
A simple conceptual Thue program to illustrate factorial transformation.
Frequently Asked Questions about Thue
What is Thue?
Thue is an abstract computational model based on string rewriting systems. It allows defining rules to transform strings, serving as a theoretical model for computation and a framework for exploring universal computation.
What are the primary use cases for Thue?
Study of formal languages and rewriting systems. Turing-completeness demonstrations. Exploration of non-deterministic algorithms. Teaching computational theory concepts. Theoretical experiments in automata and computation
What are the strengths of Thue?
Simple yet universal computational model. Demonstrates Turing-completeness in minimal form. Useful for educational purposes in computation theory. Explores non-determinism and computational paths. Highly abstract, applicable to various formal systems
What are the limitations of Thue?
Not practical for real-world programming. Execution can be highly inefficient. Non-deterministic versions are hard to analyze. Limited tooling and software support. Requires strong theoretical background to use effectively
How can I practice Thue typing speed?
CodeSpeedTest offers 10+ real Thue code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.