Questions tagged [language-design]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
26 views

Resources on designing query languages

I'm looking for resources (books, papers, tutorials) on designing domain-specific query languages. I'm mostly interested in the design of syntax and grammar, rather than the implementation. Any UX-...
Tim's user avatar
  • 111
0 votes
1 answer
31 views

What name is used in the literature for an interpreter or compiler which compiles and executes all function calls which have constant literal inputs?

In the following discussion, we use the term old programming language to refer to programming languages which had their first release prior to the year 1990. In old programming languages, there was a ...
Toothpick Anemone's user avatar
0 votes
1 answer
71 views

Can contiguous arrays be lazily evaluated?

Contiguous arrays with variable length, such as C++'s std::vector, have been a major sequential container for languages whose evaluation is eager. However, it has ...
Dannyu NDos's user avatar
0 votes
2 answers
48 views

Types and programming languages: strange term construction?

Pierce's Types and Programming Languages has the following definition of terms: $$S_0=\emptyset$$ $$S_{i+1} = \{true,false,0\} \cup \{succ(t), pred(t),iszero(t)|t \in S_i\} \cup\{if(t_1)then (t_2)...
Hank Igoe's user avatar
  • 179
-3 votes
1 answer
69 views

A chatbot's take on dynamic scoping: it is easier to debug - correct?

I asked the chatbot at you.com, "what is an advantage of dynamic scoping?" and it said the following on the pane titled YouChat. (If you click the link, you will probably see a different ...
Hank Igoe's user avatar
  • 179
0 votes
3 answers
162 views

In data structures, there are many identifiable characteristics, but what are the characteristics are of primitive-data types?

Data Structure a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data ...
cozycoder's user avatar
  • 123
5 votes
3 answers
2k views

automatic memory allocation

Global variables are given fixed addresses in main memory by the C compiler, called static memory allocation. Function local variables are created on the stack, this is called automatic memory ...
DanielJackson1's user avatar
1 vote
2 answers
348 views

How to disambiguate CFG with unary/binary minus and binary prefix operator

I'm designing an expression language that's trying to (a) be maximally compatible with a different ambiguous language; and (b) be LR(1). I'm facing the current fragment of the language: $$ \begin{...
Jonas Kölker's user avatar
1 vote
1 answer
32 views

Is a constant literal an example of a built-in?

My understanding is that in a programming language, built-ins are bindings that exist without the user having to make them. (Like + to its referent, for example.) ...
Eric Auld's user avatar
  • 115
1 vote
2 answers
205 views

Why does Python allow stand-alone expressions?

In Python, this is a valid program def PrintWorld(): print('World') print('Hello') 0 'beautiful' True None 0 < 0 3, 3 lambda c:3 PrintWorld() All it does ...
Jann Poppinga's user avatar
0 votes
1 answer
83 views

How to do asynchronous programming with only global variables?

If a programming language only supports global variables, is it still possible to use asynchronicity, like callbacks, event-driven programming, other kinds of parallelisation? How can it be done?
minseong's user avatar
  • 161
3 votes
1 answer
170 views

Why is the address-of operator in C/C++ represented with the "&" symbol?

I've started learning C++, and I know a little bit of C. Something that always struck me as somewhat off was that the address-of operator is represented with the seemingly random ampersand (&) ...
Nat H's user avatar
  • 31
5 votes
2 answers
306 views

Regarding Backus' Commentary on von Neumann-style Programming

in John Backus' 1978 FP paper "Can Programming Be Liberated from the von Neumann Style" he says To help assemble the overall result from single words [von Neumann ie. conventional mutation-...
user3779002's user avatar
1 vote
1 answer
61 views

CFG for a given languague

Give a CFG for the languague L = $ \{ 1^n +1^m = 1^{n+m}| n,m \in N_{0}\} $ , with the alphabet $\Sigma =\{1,+,=\}$. I am currently trying to solve the given task, I thought a good way is to split ...
Frank's user avatar
  • 147
1 vote
2 answers
102 views

What is the property of a PL that extracting a subroutine should not change the meaning?

What is the name of the property of a Programming Language that says that extracting a subprogram into a subroutine and using that subroutine instead of the subprogram should not change the meaning of ...
Jörg W Mittag's user avatar
3 votes
0 answers
33 views

What the type of an overloaded function should be?

Anecdotally, Virgill III language forbids overloading since overloading resolution is at odds with the language support of functions as first-class citizen, when resolution can't happen at compile ...
YvesgereY's user avatar
  • 141
1 vote
0 answers
71 views

How to use dynamic scope?

I have this example code, which is an undefined language. We want to know what will be printed if we use static versus dynamic scope. ...
Addem's user avatar
  • 335
4 votes
1 answer
515 views

Why are struct and class essentially the same in C++?

struct and class in C++ are nearly identical (as covered for example here). But why is this so? What did happen when C++ was ...
hyde's user avatar
  • 153
4 votes
0 answers
81 views

Scopes vs objects -- would a language make sense that voids the difference?

So there's this adage that says "Objects are a poor man's closures", which can equally well be reversed, which I understand to mean that they are equivalently expressive. What strikes me about the ...
Kelley van Evert's user avatar
1 vote
1 answer
183 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 ...
user101144's user avatar
1 vote
2 answers
234 views

Is lazy evaluation required for do-notation?

Do-notation is most famous by Haskell, which is also famous for having lazy evaluation. But is lazy evaluation a requirement for implementing do-notation? In principle, could do-notation be added ...
sdgfsdh's user avatar
  • 173
0 votes
1 answer
162 views

Why in Declarative Programming variables are not reassigned?

I've read that a Declarative language is called "stateless". This means that we can imagine that internally every variable is a constant variable, and it never get reassigned ( in contrast with what ...
Jhdoe's user avatar
  • 133
2 votes
5 answers
270 views

Are there any programming languages which support user defined control structures?

For instance, the user would define a for each loop in their code as having a structure something like: foreach([variable1] : [variable2]){ [statements] } (...
electricglow's user avatar
1 vote
3 answers
78 views

Is there a reason to NOT wrap preprocessor macros in parens?

I'm writing a design document for a macro expansion language that is specifically intended for arithmetic operations on integers. I've already determined that not wrapping macros with parens can lead ...
user avatar
23 votes
0 answers
1k views

Can a calculus have incremental copying and closed scopes?

A few days ago, I proposed the Abstract Calculus, a minimal untyped language that is very similar to the Lambda Calculus, except for the main difference that substitutions are ...
MaiaVictor's user avatar
  • 4,127
1 vote
0 answers
101 views

Translation from Intermediate Language into 'three-address' machine instructions

I am unsure where to start with this. From what I understand so far, 'VAR(x)' corresponds to Rule 2, ':= VAR(x) ' refers to Rule 5 and '+ NUM (1) refers to link 3. ...
Frank Duckworth West's user avatar
0 votes
1 answer
45 views

extend ECMAScript by adding new keywords and syntax

I would like to extend ECMAScript by adding new keywords and syntax to it, for example: |variableName| stipulates a special kind of variable which I would like to be able to include in a normal ...
oskar132's user avatar
  • 103
4 votes
1 answer
688 views

Which is easier for human perception: type of variable before or after its name?

In some programming languages type of variable goes before it's name. In another - name goes first and then type. Which version loads brain less and allow easier think about problem ?
R S's user avatar
  • 141
0 votes
0 answers
32 views

How can fuzzy logic be applied to computer language design?

Is fuzzy logic in any way applicable to general-purpose language design? If yes, then how would a computer language theoretically benefit from first order support of fuzzy logic?
Aria's user avatar
  • 101
1 vote
1 answer
46 views

Was multiple inheritance ever implemented by adding redundant data members?

In discussions about why most languages which implement inheritance only implement single-inheritance, the question of the precise semantics of overlaps often comes up, and having redundant data ...
Ryan1729's user avatar
  • 364
0 votes
1 answer
133 views

Are there any languages without tokens?

I know a lot of computer languages and they all use tokens. E.g. in very early BASIC you could say LET answer = 42, which is composed of seven tokens, ...
CJ Dennis's user avatar
  • 101
5 votes
2 answers
617 views

Why don't imperative languages like C or Go support Haskell-like parametric polymorphism?

Why don't imperative languages support parametric polymorphism as powerful as whats in Haskell and OCaml? More specifically if I call a function foo(x) that ...
hgs3's user avatar
  • 253
1 vote
1 answer
98 views

Can all optimizations be expressed in source code?

If someone compiled a program with all optimization settings enabled, would it be possible to create source code that, if it was compiled with all optimizations disabled, produced an identical binary? ...
Ryan1729's user avatar
  • 364
0 votes
1 answer
79 views

A systematic approach to creating a simple test parser

I need to create a simple text parser that replaces {tokens} with text from a table. The more complicated bit is the {?text?} ...
martixy's user avatar
  • 103
3 votes
1 answer
222 views

Return destinations for an expression-oriented programming language

I am designing a programming language and I want to give everything the ability to return a value. For example, if I use a block as a right-hand side value, I can assign it to a lvalue: ...
Peter Lenkefi's user avatar
0 votes
2 answers
349 views

Can String be a subtype of Character in a programming language?

Could a programming language be designed so that there is an inheritance relationship between string and character (both of ...
tpm900's user avatar
  • 365
8 votes
2 answers
347 views

What would a language look like in which precise GC was implementable as a library?

Suppose you have some programming language with manual memory management. What features does this language need to have in order to be able to implement precise garbage collection as a library, and ...
Daniel Shapero's user avatar
1 vote
1 answer
148 views

Metaprogramming taken to an unnecessarily high level- how can a program write not just other programs, but a programming language? [closed]

So basically, automated language-oriented programming. I've tried finding info on this concept, but have had some trouble, probably because my brain is having a bit of trouble grasping the subject ...
Zachary Johnson's user avatar
1 vote
0 answers
75 views

Languages with Multiple Arbitrary Return Values

I am designing a DSL for writing numerical simulations. I am working on a specific issue related to returning values from functions, and I am wondering if any other existing language solves the same ...
n00b101's user avatar
  • 111
0 votes
1 answer
339 views

The ultimate virtual machine

It seems to me that one way computer science could be divided up, is into three domains: What is efficient for humans to represent and comprehend What is efficient for computers to represent and ...
sfultong's user avatar
11 votes
4 answers
1k views

Does it make sense to have both the concept of 'null' and 'Maybe'?

While creating a client for a web API in C#, I ran into a problem regarding null as a value where it would represent two different things: nothing, e.g. a ...
Stijn's user avatar
  • 213
10 votes
1 answer
2k views

Types as first class Citizen

Coming from a C++ background I don't understand why one needs types / type expressions as first class citizen? The only language I know that supports this feature is Aldor. Does anybody have some ...
paul98's user avatar
  • 103
6 votes
1 answer
638 views

Lazy concatenative functional language

Can the idea of concatenative programming languages be extended to call-by-need evaluation strategy? I see some problems that I will explain with few examples. I will use a prefix instead of a ...
user3368561's user avatar
0 votes
0 answers
33 views

How to design context-free grammars generating the languages with twice as many a’s as b’s? [duplicate]

The problem is designing context-free grammars generating the following languages. The set of strings over the alphabet Σ = {a, b} with twice as many a’s as b’s. I found a solution but I don't know ...
Mark's user avatar
  • 1
11 votes
3 answers
1k views

Automatic Downcasting by Inferring the Type

In java, you must explicitly cast in order to downcast a variable ...
Sam Washburn's user avatar
25 votes
3 answers
4k views

Visual programming tools, why don’t they work with the AST directly?

I've found several open source visual programing tools like Blockly and friends, and other projects hosted at Github, but could't find any that work directly with the abstract syntax tree. Why is ...
rraallvv's user avatar
  • 353
6 votes
1 answer
314 views

Safe way to explicitly define new types instead of using Algebraic data types for my functional language

Question: As I'm working on a Hindley-Milner typed lambda calculus, in order to make it usable I need to add some types such as list and pairs. The way I currently do it is, I have an ...
Juan's user avatar
  • 755
1 vote
2 answers
569 views

Should names of built-in funtions be part of BNF grammar?

We're creating our own programming language for a subject. And we're confused whether to add the names of the functions we want to have in our language (like our own version of print) in the BNF ...
Aquila0916's user avatar
5 votes
1 answer
787 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 ...
tedd's user avatar
  • 53
4 votes
1 answer
192 views

What techniques could be used to support thread-local contexts and resources in a language?

I am interested in the subject of thread-local contexts, which is a feature that I use quite often in solutions, but seems to lack first-class support in any languages I have used. Quite often in ...
rghome's user avatar
  • 141