Author Topic: Describing programming languages in linguistic terms  (Read 797 times)

Offline FlatAssembler

  • Linguist
  • ***
  • Posts: 78
Describing programming languages in linguistic terms
« on: August 30, 2017, 11:58:42 AM »
What do you guys think, can pointers in programming languages be correctly described as pronouns?

Offline Daniel

  • Administrator
  • Experienced Linguist
  • *****
  • Posts: 1583
  • Country: us
    • English
Re: Describing programming languages in linguistic terms
« Reply #1 on: August 31, 2017, 01:12:10 AM »
Certainly you can describe programming languages like natural languages, but for the most part you will just be making analogies rather than really finding substantive similarities. There are some similarities, of course, such as argument structure, but the entire format of programming languages is very different. Procedural languages are, in the broadest sense, something like imperatives, and they work differently from most natural language discourse. The hierarchical relationships, though present in both, are also very different. If you look instead at declarative languages, there is a little more similarity, but I'd say that's mostly surface-level too.

As for pronouns in particular, you could call pointers, variables, and various other things 'anaphors' in the sense that they point back to some other reference (they have antecedents), but they don't function like pronouns in natural languages beyond that. For example if you look into Generative Grammar (specifically Government and Binding) you will find that Binding Theory makes some observations about when pronouns can appear-- reflexives are always within a clause with their antecedent, pronouns are not but do usually require some context, and normal nouns are never embedded in the way that pronouns can be, etc. See more about Conditions A, B and C here: https://en.wikipedia.org/wiki/Binding_(linguistics) -- and there are simply no parallels in a structural sense to programming languages.

So, can you do it? Yes. Is it meaningful beyond analogy? Probably not too much.

One substantial difference between natural languages and programming languages is that the former are extremely ambiguous, while the latter should never be. There are reasons for that, and also for other fundamental differences.

So overall, you need to decide if you're looking just for description (which you can do any way you'd like) or some kind of explanation (which must get at some deeper level of analysis). To think about that more, it might be worth reading Haspelmath's paper "Pre-established categories don't exist-- consequences for language description and typology" here: https://www.degruyter.com/view/j/lity.2007.11.issue-1/lingty.2007.011/lingty.2007.011.xml or http://www.eva.mpg.de/fileadmin/content_files/staff/haspelmt/pdf/Preestablished.pdf
While Haspelmath's perspective is controversial (some linguists would say that you can identify and compare the 'same category' in different languages!), the points he makes are important if you want to think about the difference between description and explanation. He is in fact (and continues to be!) a comparative linguist (typologist) despite making the arguments he does. You can compare languages regardless of whether they are really 'the same', but getting to a level of explanation requires more than that.
« Last Edit: August 31, 2017, 01:16:55 AM by Daniel »
Welcome to Linguist Forum! If you have any questions, please ask.

Offline FlatAssembler

  • Linguist
  • ***
  • Posts: 78
Re: Describing programming languages in linguistic terms
« Reply #2 on: September 03, 2017, 08:04:44 PM »
I don't know. Don't you think that there is some limit in details in which you can describe any particular language? That, after some relatively small number of rules, not even the native speakers of the same dialect would agree what's grammatical and what isn't? I mean, yes, you can find an almost exceptionless rule in some unexpected part of a language, like that it's grammatical to say "Oh yeah!" but not to say "Yeah oh!". But that doesn't mean that language is completely predictible and that it makes sense to invent a new class of words in an attempt to describe language in details that probably don't even really exist.

Offline Daniel

  • Administrator
  • Experienced Linguist
  • *****
  • Posts: 1583
  • Country: us
    • English
Re: Describing programming languages in linguistic terms
« Reply #3 on: September 04, 2017, 07:16:06 AM »
There we two distinct questions:
1. Do all speakers of "English" have exactly the same grammar rules? (No. There is a lot of dialectal and even speaker-level variation. In fact many linguists like Chomsky don't even consider "languages" in the sense of "English" etc. to be relevant theoretical constructs. Each person has a unique internal grammar, which Chomsky calls i-language for example.)
2. Are individuals consistent in the application of linguistic rules? (Yes, generally. But there are some claims about some rules being probabilistic. That's an interesting area of current research.)
Welcome to Linguist Forum! If you have any questions, please ask.

Offline FlatAssembler

  • Linguist
  • ***
  • Posts: 78
Re: Describing programming languages in linguistic terms
« Reply #4 on: September 04, 2017, 08:18:26 PM »
Well, when speaking a foreign language, I am obviously not consistent in my application of grammar rules. Why does anybody think people are completely consistent when speaking their native language?

Offline Daniel

  • Administrator
  • Experienced Linguist
  • *****
  • Posts: 1583
  • Country: us
    • English
Re: Describing programming languages in linguistic terms
« Reply #5 on: September 04, 2017, 09:17:21 PM »
Those are very different situations. Being a native speaker is cognitively and behaviorally distinct from being a second language speaker.

You are correct that native speakers do produce errors, but not to the extent or in the variable way that learners do. And more importantly, they often recognize their own errors (e.g., talking too fast, etc.).
Welcome to Linguist Forum! If you have any questions, please ask.

Offline FlatAssembler

  • Linguist
  • ***
  • Posts: 78
Re: Describing programming languages in linguistic terms
« Reply #6 on: September 09, 2017, 08:19:13 AM »
You know, it's not like you don't have any linguistic intuitions when you speak a foreign language. When I speak English, I can't say the likes of "You is smart." with a straight face without effort. Yes, when I make complex sentences, and want to be sure they are grammatical (which I almost never do), I have to pay attention to the consecutio temporum. But I am pretty sure that, in common speech in Croatian, there is a completely free alternation between the perfect and pluperfect after the particle "već" (already).
« Last Edit: September 09, 2017, 08:20:50 AM by FlatAssembler »

Offline Daniel

  • Administrator
  • Experienced Linguist
  • *****
  • Posts: 1583
  • Country: us
    • English
Re: Describing programming languages in linguistic terms
« Reply #7 on: September 09, 2017, 12:47:13 PM »
Yes, you can have intuitions in a second language, but they vary from intuitions in a first language. For example, as you describe, they are not "complete". Arguably you are "fluent in the basics" (even nativelike?) and have intuitions for that, but for other things you don't necessarily have intuitions. And even if you do, they usually differ from native speakers, at least in some ways. Very few learners who started as adults reach levels indistinguishable from native speakers, and even in terms of processing research has shown that first and second languages function different cognitively in some ways. Partly it is because second language learners tend to form and 'interlanguage' that at least in some ways mixes features of the two languages, and that doesn't usually completely go away even after fluency or even reaching nativelike levels (still not quite 'native'). There is much more research, of course, in the fields of first language acquisition and second language acquisition, more than I can even summarize here.
Welcome to Linguist Forum! If you have any questions, please ask.