Questions tagged [grammar]

For questions relating to the grammar of a programming language.

Filter by
Sorted by
Tagged with
2 votes
3 answers

How to support syntax like `a && b = c` for a conditional assignment expression?

I want the expression a && b = c in my language to mean that the value of c is assigned to ...
DannyNiu's user avatar
  • 231
2 votes
0 answers

Issue with rules for custom DSL

I am struggle with implementing rules for a custom DSL with significant spaces. The key feature is that it requires spaces to be tracked and re-used. In most languages they are used to split tokens ...
defance's user avatar
  • 129
10 votes
3 answers

What is a "primary expression"?

I've found that many grammars have a production called PrimaryExpression or something along those lines. ECMAScript has ...
Lazar Ljubenović's user avatar
6 votes
3 answers

Order-independency of Nonterminals in EBNF Grammar Spec

I have created a simple markup language that consists of simple tags to write my blog contents. I write my blog posts in that language and convert them into HTML with a compiler. Users can specify the ...
jtxkopt - Stand With Palestine's user avatar
4 votes
1 answer

Is PicoBlaze assembly language a context-sensitive language?

I know one example of context-sensitivity in programming languages is the so-called typedef problem. Basically, the words can be different types, and that influences how a sentence may be parsed. For ...
FlatAssembler's user avatar
9 votes
3 answers

What are the advantages/disadvantages of distinguishing statements and expressions?

Some languages distinguish expressions from statements so that something like int x = 2; foo((x += 2)); is invalid. Other languages don't, so that a similar ...
Aman Grewal's user avatar
4 votes
2 answers

In a grammar specification, how to exclude characters?

I want to specify in my grammar that an identifier could be any character except for a list of characters (that is have a deny list instead of the most common allow list). I've seen the common ...
OscarRyz's user avatar
  • 199
2 votes
1 answer

What are grammar checker tools that can be used when designing a new language?

When designing a programming language, before even writing the compiler's code, what are existing tools allowing to write a grammar, which can then check it for ambiguities and test it with sample ...
privpub19's user avatar