Skip to main content

Questions tagged [syntax]

Syntax refers to the set of rules that define how to write a correctly structured program in a language. It explicitly does not deal with the program's meaning or interpretation.

8 votes
1 answer
2k views

Nowadays, it's very common to use BNF (or extensions thereof) to describe the syntaxes of various programming languages or their constructs. What was the situation like 60+ years ago? COBOL and BNF ...
petroleus's user avatar
  • 132
1 vote
5 answers
605 views

In all programming languages, every command is sorted as command-arguments. For instance, in pygame, the command to draw a rectangle to the screen is: pygame.draw.rect(surface,color,rect) This seems ...
user avatar
3 votes
2 answers
749 views

I recently fell in love with Factor , a programming language in the Forth family that enforces use of whitespace around identifiers, this allows creation of "functions" with extremely terse ...
Blin's user avatar
  • 139
1 vote
3 answers
643 views

For example, I know in c++, I can use myString=="abc" to check if 2 strings are equal. However, in Java, it is comparing if 2 objects are the same object. Also in other language, for ...
wcminipgasker2023's user avatar
0 votes
0 answers
313 views

I want to build a code analysis tool for personal use when programming in kdb/q. In order to do this, I need to be able to parse q code into an AST. I have never written a parser before. ANTLR4 seems ...
Chechy Levas's user avatar
4 votes
1 answer
570 views

Let's take at random a well-written piece of Rust code: let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { label: Some("Shader"), flags: wgpu::ShaderFlags::...
Zomagk's user avatar
  • 261
8 votes
1 answer
406 views

SQL Server documentation uses this notation, which is very easy to understand and consume. Is this a BNF Syntax Diagram? Or is this a different type of notation? Source: SQL server documentation page ...
user497745's user avatar
0 votes
2 answers
143 views

REST APIs in virtually all languages use methods named Get to get GetById(int id). Is it ok to use this convention for repositories? Let's say I have a Professions repository for the sake of example. ...
VSO's user avatar
  • 179
6 votes
5 answers
1k views

For the designer of a language syntax, what are some reasons to choose a repeated delimiter to escape that delimiter, instead of having a separate escape character to escape that delimiter. A common ...
Shiania White's user avatar
-2 votes
1 answer
236 views

I have seen tokens like this: var message = "Hello, {Name}"; and like this: var message = "Hello, ${name}"; and like this: var message = "Hello, @NAME"; and a few ...
1.21 gigawatts's user avatar
1 vote
3 answers
1k views

In most of the examples for Abstract Syntax Trees (AST), I see no function or classes. I am wondering, if the functions and classes are represented in the AST? If no, where should the functions, ...
Kate's user avatar
  • 11
1 vote
2 answers
2k views

I had to increment my integer twice in a loop, so I thought I would try and be clever: for (int i = 0; !sl.isEmpty(); ++i++) { ... } ++i++ however is not an assignable expression, at least in GCC. ...
Anon's user avatar
  • 3,649
0 votes
4 answers
287 views

I'm currently designing a database query language and I came to wonder what should be the best syntax for the comparison operator. Most modern languages use ==, but amongst the database languages ...
ibi0tux's user avatar
  • 241
13 votes
1 answer
1k views

Java 7+ allows to use underscores in numeric literals,which do not affect the value of the literal, yet are useful for grouping. Examples from the Java 7 documentation, entitled "Underscores in ...
David Tonhofer's user avatar
1 vote
1 answer
88 views

I am having trouble finding a lexicon which provides terminology for the explicit patterns that are employed when parsing syntax. I am trying to write about the niggling differences between the 10+ ...
Darf Nader's user avatar

15 30 50 per page
1
2 3 4 5
14