Main      Site Guide    
Message Forum
Re: Syntactical Meanderings
Posted By: Howard, on host 205.184.139.81
Date: Thursday, April 13, 2000, at 17:25:13
In Reply To: Re: Syntactical Meanderings posted by Sam on Thursday, April 13, 2000, at 10:25:28:

> > 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.

Thanks, Sam. I learned a few things there. I think I knew about syntax, but I couldn't have explained it. That is the first stage of learning. The second stage is being able to explain it to somebody else and the third is putting the knowledge to practical use. That's part of the Murrill law of learning. I'm at stage two on carburators. I know how they work, I can explain how they work, but I can't fix one.
Believe it or not, I got pretty good at programming the old Apple. I could make it flash, I could do low-res graphics, I could create a timing loop, I did all kinds of fun stuff and taught kids how to do it too, but most of it has been forgotten by now.
Howard