Questions tagged [programming-languages]

Questions related to design, implementation, and analysis of programming languages. NOT for questions about how to program, which are off-topic on this site.

Filter by
Sorted by
Tagged with
5
votes
0answers
74 views

Which languages, if any, implemented parametric polymorphism before ML?

In particular, was there any kind of implementation at the time Christopher Strachey wrote Fundamental Concepts in Programming Languages? In that work, Strachey lists Ad Hoc and Parametric ...
0
votes
2answers
87 views

What are constraints on some new logic programming language and system?

As I understand, everyone can create logic programming language and system by declaring that the valid program of some logic programming language is the set of statements in the form: ...
2
votes
2answers
193 views

Machine code and punched cards

I have been looking into the history of programming, and everybody and their grandmothers begin the subject with a claim more or less similar to the following: At first, programmers used machine ...
23
votes
2answers
7k views

Do any programming languages use general recursive functions as their basis?

This is a naïve and, therefore, possibly malformed question, so apologies in advance! My view is that a Turing Machine can be seen as the computational basis for procedural/imperative programming ...
2
votes
3answers
2k views

Interpretation of for loop.

for every j != i in {0,....,n-1} How to interpret this for loop? I never seen this type of definition of for loop. Is it like - j=0 to n-1; j !=i ; ++j
1
vote
2answers
68 views

Are all computational complexity results oracle results?

When talking about the complexity of a given operation, say multiplication of numbers, one usually counts the number of "elementary operations" that are required. For example, a common argument says ...
6
votes
0answers
67 views

Can all computational complexity results be expressed in terms of programming languages?

Computational complexity results are often explained in intuitive terms as statements about the possible efficiencies of algorithms to solve certain classes of problems. However, on a more formal ...
2
votes
1answer
101 views

Proving Progress for STLC with Linear and Unrestricted Types

In this paper Walker presents an extension of STLC with linear and unrestricted types. The proof of type soundness is left as an exercise to the reader. I encountered difficulty when attempting to ...
5
votes
1answer
174 views

How to transpile generic functions into language that do not support generics?

Currently, I am developing a transpiler for my own language, however, I find difficulties to transpile generic functions. For example, how would you translate the following Java-like code in to C? <...
2
votes
1answer
139 views

Circular queue problem

In ciruclar queue the following command statement is very useful to use the determine the unused location. What is its importance? I know that without this line it won't be a circular queue. But how ...
0
votes
1answer
37 views

Comparing turing based programming languages

According to Turing thesis, Can we say all programming languages that support turing machine like C have same power for solving problems and performing algorithms? In other words is there any ...
54
votes
9answers
27k views

What is a safe programming language?

Safe programming languages (PL) are gaining popularity. I wonder what is the formal definition of safe PL. For example, C is not safe, but Java is safe. I suspect that the property “safe” should be ...
1
vote
1answer
148 views

How to resolve issue of circular definition for an `If` statement

I am trying to define an If statement, but am stuck because the definition/implementation of If is circular from what I have ...
2
votes
1answer
77 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
2answers
226 views

Confusion about the definition of de Bruijn terms in the TAPL book

I'm working through Types and Programming Languages right now, and I'm a little confused about the recursive definition given for nameless/de Bruijn terms (chapter 6, definition 6.1.2). Below is the ...
1
vote
0answers
67 views

Best way to make the jump from programming to computer science

I have decent enough experience with programming to be able to tackle most things but I want to know how you recommend making the jump from just programming to computer science. I still have a couple ...
2
votes
1answer
175 views

Why is it called 'throwing' an exception?

I'm just wondering where the phrase "throwing" an exception came from. I understand "raising" an exception but I'm wondering if "throwing" has a reason or meaning behind it?
-2
votes
1answer
60 views

Erlang- Creating a function which only adds/subtracts positive integers

I want to create a function which allows me to input a list, and then add all of the positive numbers from the list together, leaving any that are negative. ([3,1,-1]) For example only 3 and 1 would ...
2
votes
1answer
105 views

How to implement polymorphism in a turing complete environment?

I'm currently programming in an unnamed turing complete language which has support for pointers, primitive data types, structures, closures, and garbage collection, among other things. I'm trying to ...
3
votes
0answers
41 views

Query Langauge analogy to Turing Completeness

Is there a completeness property for query languages (like SQL, Cypher, Datalog, etc) that is analogous to Turing completeness in programming languages? I wondered if it is something like being able ...
1
vote
1answer
71 views

What sort of code is this?

Here is a question I encountered:- Read this section of program code that inputs 10 positive numbers and then outputs the smallest number input. Identify three changes you would need to make to find ...
0
votes
1answer
116 views

Concurrency and fairness

I'm studying the concurrency in programming and the atomic instructions. What i have not understood is the concept of "fairness" applied to this matter. Can you give me an hint ?
0
votes
0answers
24 views

Concurrency and non deterministm

I was introduced in concurrency programming this morning. I haven't understood why "non deterministm" is a fundamental aspect of cuncurrenty programming. What i think is that, since there is a ...
1
vote
0answers
37 views

Good pointers to learn foundations of Program induction and Program synthesis

I was interested in learning more about program induction and program synthesis. I was especially interested in learning about how to form program from data for example. My background is in ...
3
votes
3answers
171 views

Is it possible to make a language that can build upon itself perfectly?

First of all, note that I'll have to explain my thoughts in a layman's terms. There are so many high-level programming languages out there that compete with each other. This means we have to build ...
2
votes
0answers
56 views

Are JavaScript libraries “linked” like C++ libraries?

I'm trying to better understand the concepts of static and dynamic linking, in terms of the ways JavaScript libraries are used in modular systems. Does it ever make sense to describe a JavaScript ...
1
vote
1answer
37 views

How do you implement a language with greater capabilities using subordinate languages?

I've heard that C++ and Python where implemented using C. How can someone make an object oriented language out of something that doesn't support objects? I've read in the book "Math You Can`t Use - ...
0
votes
1answer
34 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 ...
0
votes
0answers
38 views

Computational cost of using dictionary in floating point opertations

I would like to know the computational cost of using/accessing a dictionary. This should depend on the length of the dictionary. Say a dictionary $D$ has $n$ elements. What would be the cost of ...
6
votes
1answer
1k views

What is the origin of dot notation?

In object-oriented programming, dot notation is used when accessing the properties or methods of a class: ...
1
vote
1answer
63 views

Structural induction proof

I need to prove the following: reverse(append(zs, z)) = Cons(z, reverse(zs)) Where: ...
2
votes
3answers
137 views

Are programming languages ultimately procedural?

I'm studying a declarative programming language (Prolog) and in thinking about how certain things are programmed at a low level, a question came to me: are programming languages ultimately procedural ...
0
votes
1answer
56 views

How to define whitespace for certain rules but else ignore it

I am trying to make a programming language for the first time and wonder how it handles whitespace. I can see CFG by default seem to just ignore whitespaces, but what if I want it to use it sometimes? ...
4
votes
1answer
660 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 ?
2
votes
1answer
99 views

Can we implement every algorithm using only immutable variables?

Can we implement every algorithm using only immutable variables such that their space and time complexity is the same as using mutable variables?
1
vote
1answer
141 views

Why are the control statements[if-else, while, for] commonly used in programming?

One simple question I've never been able to answer is, "why use 'for', 'while', and 'if' as control statements?" Could someone please elucidate the rationale behind using the above mentioned control ...
4
votes
3answers
92 views

call by name : how are clashing variables handled?

In call by name : In general, the effect of pass-by-name is to textually substitute the argument expressions in a procedure call for the corresponding parameters in the body of the procedure. ...
-1
votes
1answer
30 views

General algorithm for generating a description of the language it is written in [closed]

Does there exist a general algorithm which can output a finite and complete description of the (programming) language in which it is written, if it is given the permission to execute programs in that ...
0
votes
1answer
200 views

What is the difference between a Standardization and a Specification?

While asking this question on "what exactly is standardization", I remebered that another related term that always came up while reading about C libraries was the term "specification". To avoid asking ...
0
votes
3answers
672 views

What is standardization in computer science?

I was reading about the differences standards and specifications for C. I understood that programming languages are usually stadardized and I learnt that there are different approches to ...
0
votes
0answers
64 views

How can Interpreter run JIT Compiled Code

I do not understand how a program such as an interpreter can run and create code "on the fly" to run. Can someone help me understand what such a program would have to do in order to function? I'm ...
0
votes
0answers
29 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?
0
votes
4answers
351 views

Grammer Class/Production Rules of Programming Languages

I'd read around on the interwebs, and a lot of the text indicated that many programming languages are generated by a context-free grammar, which leads me to 2 questions: Doesn't variable scoping ...
26
votes
7answers
7k views

Are all turing complete languages interchangeable

Note, while I know how to program, I'm quite a beginner at CS theory. According to this answer Turing completeness is an abstract concept of computability. If a language is Turing complete, then ...
1
vote
0answers
173 views

'if' and 'while' statements within a SIMD architecture and its memory architecture

I am doing some past exam papers and I found two interesting questions which I cannot answer due to them not being extensively covered in the lecture notes given to me by my lecturer. The questions ...
0
votes
2answers
575 views

Is the implementation relation between an interface and a class an instantiation or inheritance relation, or neither?

In Python, we have metaclass and abstract class. In Java and C#, we have interface and <...
2
votes
1answer
45 views

Typing by value

I wondered if there was a generalized name for typing a variable by assigning a specific value to it. For instance a = 4 This would make the variable ...
4
votes
1answer
76 views

Why does substitution terminate?

I'm formalizing some properties of lambda calculus in Coq and I have some problems proving termination of substitution. My terms are defined as: ...
0
votes
0answers
38 views

Are the terms “Language Implementation”, “Runtime” and “Virtual Machine” synonymous?

To describe the implementation of a dynamic programming language, I have seen the terms "Runtime" (e.g. Security transparency in the Python runtime), "Virtual Machine" (Python Virtual Machine (PVM), ...
5
votes
2answers
2k views

The difference between compiler and interpreter

I am reading dis, It reads: The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/...