Questions tagged [syntax]

53 questions
23
votes
4 answers

Are modern programming languages context-free?

Which language class are today's modern programming languages like Java, JavaScript, and Python in? It appears (?) they are not context-free and not regular languages. Are these programming languages context-sensitive or decidable languages? I am…
Jonte YH
  • 463
  • 1
  • 4
  • 11
13
votes
3 answers

Which other programming languages apart from Python and predecessor are out there using indentation to define code blocks?

Python quite famously uses indentation to syntactically define blocks of code. (See Compound statements in the Python Language Reference). After years of using Python I'm still intrigued by and very fond of this syntax feature. But I wonder: Apart…
halloleo
  • 257
  • 2
  • 5
8
votes
2 answers

Why is BNF considered an unsatisfactory technique for describing a language?

I was reading the paper Fundamental Concepts in Programming Languages by C. Strachey the other day, wherein I read something that was quite strange to me. Quoting directly (with the strange part highlighted by me): Faced with the situation as it…
7
votes
2 answers

Are syntax and semantic just 2 structures such that one is a model of the other?

The syntax of a language is a structure. The semantic of a language is a structure. The semantic of a language is a model of its syntax. And that's all ? The duality syntax/semantic is just model theory applied to languages ? (A short answer…
5
votes
0 answers

Dennis Ritchie citation for "the C declarator syntax is an experiment that failed"?

I've often heard that the C declarator syntax described as "an experiment that failed." I've seen claims that this sentiment is also shared by its creator Dennis Ritchie. Does anybody have an actual citation for this? I'm doing a related project and…
5
votes
1 answer

Examples of context sensitive syntactic constructs (statements)

So, I am implementing a context sensitive syntactic analyzator. It's kind of an experimantal thing and one of the things I need are usable syntactical contructs to test it on. For example, the following example isn't possible to parse using standard…
5
votes
2 answers

Break keyword outside a loop is syntax error or semantic error?

I am designing a simple compiler for my university project. In my programming language, the break keyword is allowed. I want to know whether break keyword occurs outside a loop should be a syntax error or semantic error. I want to know what is the…
5
votes
1 answer

Parser theory: How to systematically compute FOLLOW sets?

Forgive me for my ignorance as I am self-teaching myself some of this theory... I am having some trouble understanding how to systematically/algorithmically compute FOLLOW sets, given that I have computed the FIRST sets. For the following…
4
votes
2 answers

What are the modern alternatives to Backus–Naur form and what are their advantages?

I am very new to the whole concept of context-free grammars to represent the syntax tree of formal languages (i.e., programming languages). It seems that the Backus–Naur form (BNF) is the oldest of all possible notations and the most prevalent one.…
4
votes
2 answers

Origin of using ">" to represent child in a tree

What are the earliest known uses of the "greater than"/"chevron" symbol (>) to denote a parent-child relationship in a tree structure? i.e. parent > child e.g. CSS Child Combinator (initial definition) Breadcrumbs
3
votes
1 answer

Simple example for Higher Order Abstract Syntax (λ-tree syntax)

I am reading https://www.cs.cmu.edu/~fp/papers/pldi88.pdf and https://en.wikipedia.org/wiki/Higher-order_abstract_syntax for trying to understand encoding of linear logic using HOAS into Coq. But I still cannot grasp whats going on? Is there simple…
TomR
  • 1,411
  • 8
  • 17
3
votes
1 answer

Is there a correspondence between the syntaxes and the type systems of programming languages?

I was reading the first chapter of Robert Harper's Practical Foundations for Programming Languages in which it introduced abstract binding trees, aka abt. It seems pretty like typed lambda calculus. There are ground sorts, which are similar to…
盛安安
  • 944
  • 5
  • 14
3
votes
0 answers

A syntactic property of computing systems: is non-coding DNA universal?

One of the surprising aspect of the genome for lay-people is that it contains important non-coding DNA parts, which does not mean that they are all useless. I never paid so much attention to the fact, until very recently, when I realized that the…
babou
  • 19,645
  • 43
  • 77
3
votes
2 answers

Differences in Postfix Syntax

A question about postfix/RPN came up in my class due to the current ACSL competition. Is it a rule or convention that 4 + (5 * 6) in infix is written 4 5 6 * + in postfix, as opposed to 5 6 * 4 + in postfix? When the second postfix example is…
3
votes
2 answers

How is `y λx.x y` parsed using the standard pure untyped lambda calculus conventions?

How would the following term in the pure untyped lambda calculus be parsed: y λx.x y The relevant conventions listed on https://en.wikipedia.org/wiki/Lambda_calculus_definition#Notation (as well as many texts on this subject) state: Applications…
digilante
  • 31
  • 1
1
2 3 4