A program full of syntax errors may not be a valid program, but it can be valid art.
A program full of syntax errors may not be a valid program, but it can be valid art.
Is this a valid program?
Well, probably not, right now as I'm writing this. But all it takes is someone writing an interpreter that maps words to a suitable instruction set. It probably won't do anything sensible, where do you draw the line? Translating code to other forms and back has a long history that very often has been about doing it for the sake of it rather than for functionality or practicality.
I've linked to this elsewhere:
https://www.reddit.com/r/programming/comments/b9fqwj/93_of_p...
But much more famous were the many incarnations of DeCSS that sought to to blur the lines between code and other expression:
"Is this a valid program?" is syntactically and semantically valid Ruby for example. But in itself it will just throw an error [some might argue this means it is not a valid program, but these errors are part of the normal runtime control flow of Ruby]. Depending on environment, however, it can do something else.
E.g. if your environment contains this:
def program?; 42; end
def valid(arg); arg; end
def a(arg); arg; end
def this(arg); arg; end
def Is(arg); arg; end
Then the string Is this a valid program?
Will execute and return 42.A lot of random text will be valid programs in any number of existing languages without any intent for them to be so. But any random text can be valid programs in an infinite number of possible languages that does not yet exist.
So the question of what is a valid program is very much a philosophical one about whether or not the intent of the author matters in the face of processors that can re-interpret the data in ways it was not intended.