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
0
votes
0answers
19 views

Which of the following does not necessarily have a side effect? [closed]

Which of the following does not necessarily have a side effect(in java)? printing data to the standard output reading data from a database setting the value of a local variable setting the value of a ...
0
votes
2answers
51 views

How was swapping program born?

Code: a=10 b=5 temp=a a=b b=temp I am studying Python and I stumbled upon the classic program: The Swapping Program. It is simple: ...
0
votes
0answers
19 views

Shallow Binding with static scope, is it possible?

I'm new in programming, I'm currently studying programming languages. I'm trying to implement Shallow Binding with static scope, starting from an abstract syntax (producing a programming language ...
-4
votes
0answers
23 views

writ the code for the following using python [closed]

help! I tried to do it but I can't seem to get it right can someone help out? we are supposed to use python and create a clock with the following variables.
0
votes
1answer
32 views

Which type can cause problems with encapsulation in Java?

Out of the following, which type can cause problems with encapsulation? A. Int B. Int[] C. String D. non of the above I chose D and was incorrect. I am kind of confused what this questions is asking ...
0
votes
0answers
21 views

why monads/fp/haskell isn't consider Von Neumann [closed]

enter code herewhat im not talking about parallel support for example, im talking more about if even possible to write a io problem whiteout mutable statements ? "Now, IO isn’t actually a “...
-4
votes
0answers
19 views

How do I go about writing this programme [closed]

Write a Python program that: Reads a sentence from standard input Writes this sentence on standard output all in lower case Writes this sentence on standard output with all vowels in upper case and ...
0
votes
0answers
16 views

How to create a Test Case Set where optimal testing should be performed with as few test cases as possible? [closed]

I have a basic C# console application, where there are 5 if statements. I have to make 2 Test Case Sets of this software, the first set with 3 test cases and another one where optimal testing should ...
0
votes
1answer
25 views

Grammar where the precedence of condition operators are asymmetric with regard to assignment operators

In Unix shell programming, there's the ideom: program1 && program2 && program3 where successful completion of ...
1
vote
1answer
35 views

When is a stuck state not final and when is a maximal sequence not complete in transition systems?

Reading the book Practical Foundations for Programming Language. In section 5.1 Transition Systems, the author said that Whereas all final states are, by convention, stuck, there may be stuck states ...
2
votes
0answers
15 views

History of the category of effectful computations

The 1971 paper A Catalog of Optimizing Transformations contains this passage: irreducible subprograms require special handling. (An irreducible subprogram is one which maintains a history, performs I/...
2
votes
2answers
73 views

Semantics and implementation of side effects

From a practical point of view, how do functional languages with formally specified semantics (like ML) handle side effects like printing? I'm aware of things like the IO monad in Haskell but I'm ...
3
votes
4answers
162 views

Are there any programming languages that support state machines in their standard library?

State machines are a fundamental computer science concept and in many senarios they are the simplest way to implement a process or program. However, most programming languages don't support them ...
1
vote
0answers
19 views

What is the practical difference between "differentiable programming" and existing autograd libaries?

People have recently started talking about "differentiable programming". I have listened to some people talk about this at a philosophical level, but I don't see the practical difference ...
1
vote
2answers
55 views

Is there any programming language focused on atemporality?

It seems like a lot of programming is about converting a high-level human intuition into a very precise, ordered set of steps and conditions for the computer to execute correctly. I think programming ...
5
votes
0answers
83 views

Does the concept of "side-effect" predate functional programming?

When I was reviewing a book, I saw that there's a sentence claiming "side effect is a term coming from the domain of functional programming". I would think that the concept existed before ...
1
vote
1answer
75 views

How does the Go language implements maps?

To what extent is the MAP data type implementation language dependant??? If we know that C++ implements maps as Red Black Trees, unordered maps as hash tables, How C++ and alike maps are actually ...
-2
votes
1answer
45 views

What is the reason for this contradiction about the size of the char type?

the size of one char in C is 4 bytes, however to define an 'A' character we use the sum of two values like this expression here: or in other way i want to say that the char is 4 bytes size, but in ...
0
votes
2answers
93 views

Are there programming languages where you import only what you need?

If all programming languages more or less compile down to the same machine code. Have there been attempts at, or is there a "field" around the concept of even more modular programming ...
1
vote
1answer
49 views

Would all objects in a reversible computing language be mutable?

Full disclosure, I'm asking this after watching a couple pop science videos; I do not know anything about the actual physics and hardware. I suspect the presenters expected an audience like me because ...
0
votes
1answer
62 views

How programming languages are capable of handling generic types

How programming languages are capable of handling generics ? Here is some context on why I got the question. Constructs like Lists, Dictionaries and Sets in Python can handle any type of data without ...
1
vote
1answer
64 views

What is the formal definition of precedence and associativity in programming language?

The concept of precedence and associativity seems straightforward. The operator precedence is a collection of rules that reflect conventions about which procedures to perform first in order to ...
1
vote
3answers
67 views

Should I be a good computer scientist to become a great software developer?

As I am headed into a Computer Science major wishing to eventually become a software developer, I wonder this: should I immerse myself in computer science theory and knowledge (data structures, ...
0
votes
2answers
83 views

What is the best book on the theory of programing languages?

I want to learn programming. I have knowledge of mathematical logic. So, what I am searching is a book (or varios books) for learning to programming, but I think that a book like one which I imagine ...
-4
votes
1answer
95 views

Is Programming Witchcraft or Actual Magic? [closed]

I may sound stupid, but few people say that programming is witchcraft (maybe Joking) as a Christian I Must take it seriously, because I am planning to become Software Architect in the future. Honestly ...
1
vote
2answers
54 views

Loop Invariants: Can someone explain this concept?

I am reading Algorithms Unlocked By Tom Cormen and find this concept a little confusing. Why is it that we require loop invariants and how does it help in analyzing algorithms?
1
vote
1answer
23 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.) ...
4
votes
1answer
86 views

How compiler optimizations create irreducible control flow graph?

I've been looking through research papers and the internet and found many claims that "compiler optimizations can cause irreducible control flow". However, I was not able to find a single ...
1
vote
1answer
39 views

What is "invariants of the code"?

The Wikipedia page for strong and weak typing says: "Strong typing" generally refers to use of programming language types in order to both capture invariants of the code What is "...
19
votes
5answers
7k views

How do computers perform operations on numbers that are larger than 64 bits?

There are many reasons why numbers larger than 64 bits must be computed. For example, cryptographic algorithms usually have to perform operations on numbers that are 256 bits or even larger in some ...
1
vote
0answers
30 views

A beginner's question on programs that can search and calculate in very large sets

I am not in the computer science field and was looking for some guidance on books/papers/programs that allow me to learn how to design algorithms for problems that involve very large number of ...
2
votes
1answer
48 views

How does asynchronous operations save time in I/O

I'm reading a book CLR via C# which says how Windows does asynchronous I/O: To read data from the file, ReadAsync internally allocates a Task object to represent the pending completion of the read ...
2
votes
1answer
69 views

Macros vs lazy evaluation in scheme inspired language

I'm writing a simple scheme inspired interpreter. I'm not calling it a scheme implementation because I don't really want to implement all the standard, only the minimal set of primitives needed to ...
1
vote
1answer
59 views

virtual machine based programming languages vs low level

I took programming lecture it was about C/java and how to build compilers, so I wanted to know. As far I see, languages like Java/C# are developing their virtual machine CLR/JVM with good base and are ...
0
votes
0answers
38 views

Is the tidyverse a dialect of R?

Usually when I see "programming language dialect" it refers to small variations of a language, such as BASIC dialects or different versions of Lisp. The tidyverse set of packages form their ...
14
votes
4answers
8k views

Are modern programming languages context-free?

Which language class are today's modern programming languages like Java, JavaScript, and Python in? It appears (?) they are not context-free and not regular languages. Are these programming languages ...
0
votes
1answer
67 views

What other implementation styles are there besides compilation, interpretation and transpilation?

Obviously there is JIT but it is basically run-time compilation. There is also implementing things in VHDL or ASIC. But my question is more towards software techniques for program building and ...
1
vote
0answers
12 views

How do bottom up parser evaluate things that need an inherited attribute?

I learned that Bottom up parsers use only synthesized attributes to evaluate semantics. Which makes sense considering that it would be very hard to evaluate an inherited attribute in bottom up ...
2
votes
1answer
120 views

Which would be better for programming using Homotopy type theory Agda or Idris

I'm looking to model data inputs for an artificially intelligent system, which is affected by its internal parts and has feedback loops. I'd like to model it mathematically, using category theory or ...
1
vote
1answer
48 views

Why does universe level restriction behave differently between inductive family and parameterized inductive type without axiom K in agda

An observation when defining List in agda with --without-K enabled: The following parameterized inductive definition is accepted:...
0
votes
1answer
42 views

BNF syntax for a recursive function?

I'm to write a syntax that will allow for a recursive function, i.e. f(x) = if x == 0 then x else f(x+1) Here's one attempt at creating the grammar: But I don't ...
2
votes
0answers
52 views

Do any industry programming languages use Martin-Löf style identity types?

Most programming languages have some kind of type systems but are there any programming languages widely used outside of academia (in consumer-oriented tech, finance etc.) that have intensional ...
0
votes
1answer
120 views

while loop for bitwise conversion program

int counter(char c){ int count = 0; while (c!=0){ if((c & 1) !=0) count++; c = c >> 1; } } I am trying to understand a ...
0
votes
1answer
49 views

With a list of opcodes for a virtual machine, is it possible to assign a number to every possible program of size n that can be run on that machine?

Say you have some virtual machine with < 100 numbered opcodes that fully specify its behaviour. Is there an easy way to order and enumerate all possible programs of less than n instructions, the ...
0
votes
1answer
47 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?
1
vote
1answer
86 views

can a machine generate truly random numbers?

I know that for most programs pseudo-random numbers are sufficient, but there are ways that machines can generate truly random numbers! There are devices that generate unpredictable processes. However,...
0
votes
0answers
26 views

If the load factor is a decimal (say 3.6), what is the length of each chain in a hash table that utilizes separate chaining?

I understand that if the load factor were 2, then the length of the chain would be 2 for each index in the array, but what happens if the load factor is a decimal? Do we round up or down?
1
vote
1answer
93 views

Resources for implementing dependent type theory

I want to implement Martin Löf's intuitionistic type theory in a functional language such as Haskell, preferably also implementing a lexer/parser for the language. How should I start approaching it? ...
3
votes
3answers
156 views

Why do programming languages use call-by-value over call-by-name?

I am reading Software Engineering 1: Abstraction and Modelling by Dines Bjørner. One of the chapters talks a little bit about call-by-value vs call-by-name. In it, the author states that most ...
1
vote
2answers
45 views

Relation between programming languages requiring declaration of variables before use and using the token class $\text{id}$ while parsing

I was going through the text Compilers: Principles, Techniques and Tools by Ullman et. al. where I came across the following excerpt. Example 4.11. Consider the abstract language $L_1 = \text{ { $wcw$...

1
2 3 4 5
19