We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [syntax]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
12
votes
3answers
3k views

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

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 ...
8
votes
2answers
293 views

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 ...
6
votes
2answers
680 views

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 ...
5
votes
1answer
423 views

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 ...
3
votes
1answer
72 views

What is the relation between syntax and type theory?

Type theory and syntax are similar, in that they are inductive rules that determine whether a particular string of symbols is "correctly specified" in some sense. There is a difference between ...
3
votes
2answers
102 views

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 ...
3
votes
1answer
81 views

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 ...
3
votes
0answers
153 views

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 ...
3
votes
0answers
47 views

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, ...
2
votes
1answer
97 views

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. ...
2
votes
2answers
2k views

How to read BNF syntax of C?

Today I heard of BNF which is a language for languages. Also heard that it specifies the entire syntax of C in four pages. So I thought of checking it out. After reading through this page, I got a ...
2
votes
1answer
71 views

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 ...
2
votes
1answer
106 views

Is this DO LET sugar considered pure Lambda calculus and nullipotent / side-effect-free?

I'm thinking these familiar concepts of DO and LET/LET* in the context of Lambda Calculus (...
2
votes
2answers
985 views

What do I need to study in order to understand and design a programming language? [closed]

What do I need to read in in order to : understand the specs of an already made programming language Design a programming language Design a compiler and assembler for that language make an ...
1
vote
2answers
831 views

Why are syntax trees used in genetic programming?

Reading a course on genetic programming, the first chapter describes the syntax tree as the basic representation of programs in genetic programming. What are the reasons leading to the choice of a ...
1
vote
1answer
82 views

Why is the syntax of some programming languages very much not according to earlier conventions? [closed]

Looking at the syntax of the programming language C and others inspired by it, I cannot help but ask the question in the title. Mathematics, logic and other subjects have been existing for many ages ...
1
vote
3answers
1k views

Does precedence matter in constructing parse trees of arithmetic expressions for postfix notation?

Table 4 in Problem Solving with Algorithms and Data Structures's chapter on Infix, Prefix and Postfix Expressions gives the following examples: ...
1
vote
1answer
386 views

Which part of Go(lang) is in Crystal(lang)? [closed]

Reading Crystal Programming Language They says it is inspired from many programming language and Go. I would like too know which part of Golang, since it is not its syntax.
1
vote
2answers
173 views

Terminology - the reason for symbol reuse in programming languages

What is the term in programming language creation that is the rationale for symbol reuse? Though potentially confused with overloading, it is not so much the application of symbol reuse, but the ...
1
vote
1answer
73 views

Implementing Do keyword in a compiler

I'm writting a compiler implementation for a language that you can see defined here. I having problems designing how the do keyword should be handled. You can find the code I'm referring to in here. ...
1
vote
1answer
17 views

defining a programming language grammar for doing arithmetic

I'm studying programming language design, and I've been taught the grammar below which lets you write basic math expressions. ...
0
votes
1answer
202 views

Relation between “syntax” and “grammar” in CS

I do sure that "grammar" and "syntax" is two different thing in CS, e.g Syntax of Java language is defined by a context-free grammar. My question are What is different in definitions of "grammar" ...
0
votes
1answer
67 views

Do the following concepts belong to syntax or semantics?

I am not very sure about the difference between syntax and semantics. Does each of the following concepts belong to syntax or semantics? terms values: terms that are possible final results of ...
0
votes
1answer
177 views

Why postfix arithmetic expression is not ambiguous?

A binary tree can be written as an expression, no matter prefix, postfix or infix. But why an infix expression needs brackets, while the others don't? Say, why postfix, prefix produce only one binary ...
0
votes
1answer
36 views

What kind of error are these?

I was following a discussion on a forum where a person has asked whether the following generates lexical errors or not, (1) char p="gate; (2) int /* n; (3) printf("%d, n); When I tried ...
0
votes
1answer
27 views

Why does the following Backus-Naur form reflect the following syntax diagram?

The definition of the variable < number>::=< digit > | < digit >< number > where < digit > is defined as < digit > ::= 1|2|3|4|5 Apparently reflects the following syntax ...
0
votes
1answer
27 views

For Loop Range with Smaller Number on Right

Simple question from an algorithm noob... If $i=1$ then the inner loop will include what I believe to be an invalid range. Is this acceptable pseudocode? ...
0
votes
0answers
11 views

Compiler Shows: Abort Called [migrated]

When does a C++ compiler give a this message : "terminate called after throwing an instance of 'std::out_of_range'"? I was trying this problem a website. I wrote an algorithm but the code won't ...
0
votes
0answers
643 views

What is the importance of the empty string in CFG derivations?

NOTE: This question is NOT the same as this other nearly-identically worded question with some amazing answers. I learned a lot from it regarding the mathematical importance of the empty string, but ...
0
votes
2answers
217 views

generating recursive descent parser

I have a grammar, $L \to A \langle A \rangle^*$ $A \to () \mid (L)$ but I am not sure how to generate parser for $\langle A \rangle$. I know in other case, for example, if $E \to T \langle^*T\...
0
votes
1answer
4k views

In a bottom-up evaluation of a syntax directed definition, inherited attributes can

In a bottom-up evaluation of a syntax directed definition, inherited attributes can always be evaluated be evaluated only if the definition is L-attributed be evaluated only if the definition has ...
-1
votes
1answer
610 views

Programming Thompson's algorithm: How to represent a NFA?

I'm trying to create a small program that interprets a NFA to the corresponding regex using Thompson's algorithm. My question: What kind of notation can be used to express a NFA (e.g. in the form of ...