Contribution of the language network to the comprehension of Python programming code

Brain Lang. 2024 Apr:251:105392. doi: 10.1016/j.bandl.2024.105392. Epub 2024 Feb 22.

Abstract

Does the perisylvian language network contribute to comprehension of programming languages, like Python? Univariate neuroimaging studies find high responses to code in fronto-parietal executive areas but not in fronto-temporal language areas, suggesting the language network does little. We used multivariate-pattern-analysis to test whether the language network encodes Python functions. Python programmers read functions while undergoing fMRI. A linear SVM decoded for-loops from if-conditionals based on activity in lateral temporal (LT) language cortex. In searchlight analysis, decoding accuracy was higher in LT language cortex than anywhere else. Follow up analysis showed that decoding was not driven by presence of different words across functions, "for" vs "if," but by compositional program properties. Finally, univariate responses to code peaked earlier in LT language-cortex than in the fronto-parietal network. We propose that the language system forms initial "surface meaning" representations of programs, which input to the reasoning network for processing of algorithms.

MeSH terms

  • Brain Mapping / methods
  • Brain* / diagnostic imaging
  • Brain* / physiology
  • Comprehension* / physiology
  • Humans
  • Language
  • Magnetic Resonance Imaging / methods
  • Temporal Lobe / physiology