Re: Syntactical Meanderings
Sam, on host 12.25.1.128
Thursday, April 13, 2000, at 10:25:28
Re: Syntactical Meanderings posted by Howard on Thursday, April 13, 2000, at 08:25:05:
> Syntax must have something to do with language, but if it's about computer language, I wouldn't understand it anyway.
Your post seemed to be mostly humorous, but I'll answer anyway. Syntax refers to the structural rules of a language -- any language, not just computer languages -- about what constitutes a valid expression in that language. In English, a sentence can be composed of one or more words, which are composed of one or more letters, and there can be some types of punctuation interspersed. "I went to the store." is a syntactically valid use of English. "Mom peanut brittle scavenged the orange ideas of granular hatred." is also a syntactically valid use of English. "8*#Lkkjdk sv @#$@#$" is not a syntactically valid use of English. The syntactic rules of English do not permit uses of numbers and punctuation in that manner.
The bottom line is that "syntax" does not incorporate any ideas about the meaning of what is being expressed. "Semantics" refer to meaning. The rules of "semantics" refer to how valid syntactical uses of language should be interpreted. The semantic rules of English tell us what "I went to the store." actually *means*. The semantic rules of English also tell us that "Mom peanut brittle scavenged the orange ideas of granular hatred." is not valid English in spite of conforming to the syntactic rules of English (a series of words composed of a series of letters, divided by spaces, basically).
So that good old Apple II's infamous "syntax error" error message was telling you that whatever you just typed in did not conform to the syntactic rules of the programming language you were using at the time. Specifically, BASIC -- I became intimately familiar with that error message myself. Usually a "syntax error" was the result of a typo, or forgetting to put in a particular piece of required punctuation. Syntax errors are common and annoying when you're just getting into programming, but they quickly become the easiest of the various possible errors to fix, because an error in syntax has nothing to do with what you're trying to get the computer to do -- it just means you told it in a way it couldn't understand. If, on the other hand, you fix the syntax error, and then the program does something completely different from what you were hoping it would do, the debugging process is more involved, because you have to figure out where the *semantics* of your programming code weren't what you thought they were.
|