Questions tagged [language-specifications]

126 questions
1
vote
1 answer

Exact semantics of the null-forgiving operator in C# 8.0?

According to the documentation: The postfix ! operator has no runtime effect - it evaluates to the result of the underlying expression. Its only role is to change the null state of the expression, and to limit warnings given on its…
domin
  • 1,192
  • 1
  • 7
  • 28
1
vote
1 answer

Inconsistent Accessibility of Nested object Declarations in Kotlin

Consider the following Kotlin code: object Domain { val name = "local" val location = object { val city = "Pittsburgh" val state = "Pennsylvania" } } While this definition is valid and compiles, the following line fails: val x =…
LBushkin
  • 129,300
  • 32
  • 216
  • 265
1
vote
1 answer

Is it ever possible for this loop to fail to run?

A question came up recently that was a learning experience for me. Something like the following was giving a "use of undefined" error: int a; for(int i = 0; i < 1; i++) a = 2; a /= 2; It's a contrived example and doesn't make sense but it gives…
Caius Jard
  • 72,509
  • 5
  • 49
  • 80
1
vote
1 answer

Does the Perl compiler need to be told not to optimize away function calls with ignored return values?

I am writing new Perl 5 module Class::Tiny::ConstrainedAccessor to check type constraints when you touch object attributes, either by setting or by getting a default value. I am writing the unit tests and want to run the accessors for the latter…
1
vote
1 answer

Python pattern matching with language-specific characters

From a list of strings, I want to extract all words and save extend them to a new list. I was successful to do so using pattern matching in the form of: import re p = re.compile('[a-z]+',…
Jones1220
  • 786
  • 2
  • 11
  • 22
1
vote
0 answers

Official AutoIt language syntax specification

I want to create a compiler for AutoIt, which compiles it to x86-instructions - however, I was unable to find an official syntax description of the AutoIt language (may it be in form of ANTLR-syntax-description or an official syntax tree). Could…
unknown6656
  • 2,765
  • 2
  • 36
  • 52
1
vote
5 answers

Are compilers and language specification/grammars the same?

Can a compiler be written, from which you can not reverse engineer the grammar and meaning of the input language. i.e. can you always get the specification of the language from the compiler? Let's say I want to compile from ?? to some language but I…
Raynos
  • 166,823
  • 56
  • 351
  • 396
1
vote
3 answers

"one-to-one correspondence with files in a file system"

I have read in the c# language specification : Source files typically have a one-to-one correspondence with files in a file system, but this correspondence is not required What does this exactly mean ?
kkkk00999
  • 179
  • 2
  • 13
1
vote
1 answer

C++ Template Equivalence of Prototypes

The following compiles runs and executes as expected: #include #include #include #include class Freaky { public: template< typename UNSIGNED_TYPE, typename…
Persixty
  • 8,165
  • 2
  • 13
  • 35
1
vote
1 answer

JSON encoding details

I was reading JSON's succinct language specification and got surprised for this sentence: Excepting a few encoding details, that completely describes the language. What are the details which can break those simple rules.
sinuhepop
  • 20,010
  • 17
  • 72
  • 107
1
vote
3 answers

How to find out the dependent classes from a raw class file?

When I look at a binary class file can I easily find out what other classes need to be loaded in order to use this class? As a sort of "directory" I can only see the Constant Pool Table with Class entries. The 1st and 2nd entry has a specific…
towi
  • 21,587
  • 28
  • 106
  • 187
1
vote
8 answers

Why don't statements that don't do anything throw an exception (or warn the developer)?

I've been bitten a couple of times by statements in VB.NET (not sure if this effect exists in C#) that appear to be self-referencing, but when they're executed, they don't actually do anything because they require a target and one isn't provided.…
SqlRyan
  • 33,116
  • 33
  • 114
  • 199
1
vote
2 answers

Gedit Online Language Specs Generator

Is there a online generator, or something like that, of new highlightings for gedit? I am using a not known language and I would like to have syntax highlight, but it seems like too complicated and I though that could exist some online creator.
richardaum
  • 6,651
  • 12
  • 48
  • 64
0
votes
0 answers

Comparing different EBNF rules for the same programming language

Are there any open-source projects that can be used to compare two different EBNF rules that define the syntax of the same programming language? e.g.(for Rust): From Ferrocene Language Specification Item ::= OuterAttributeOrDoc*…
user584011
  • 41
  • 4
0
votes
1 answer

Counting backslashes to determine illegal unicode escapes as specified in Java Language Specification

I am reading the 3.3 Unicode Escapes section in the lang spec. (https://docs.oracle.com/javase/specs/jls/se19/html/jls-3.html#jls-3.3) There is this particular piece of text I am having difficulty understanding: consider how many backslashes…
bt01
  • 1
1 2 3
8 9