Nearly all programming languages used are Turing Complete, and while this affords the language to represent any computable algorithm, it also comes with its own set of probl
The problem is not with the Turing machine, it's with "algorithm". The reason why you can't predict if an algorithm will halt or not is because of this:
function confusion()
{
if( halts( confusion ) )
{
while True:
no-op
}
else
return;
}
Any language that can't do recursion or loops wouldn't really be "general-purpose".
Regular expressions and finite-state-machines are the same thing! Lexing and string matching are the same thing! The reason FSMs halt is because they never loop; they just pass on the input char-by-char and exit.
EDIT:
For many algorithms, it's obvious whether or not they would halt.
for instance:
function nonhalting()
{
while 1:
no-op
}
This function clearly never halts.
And, this function obviously halts:
function simple_halting_function()
{
return 1;
}
So the bottom line: you CAN guarantee that your algorithm halts, just design it so that it does.
If you are not sure whether the algorithm would halt all the time; then you probably cannot implement it in any language that guarantees "halting".