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

How to sent a alert mail in php? [closed]

I have created a login page to perform a sql injection, whenever the sql injection happens in login page admin should automatically get a alert mail. But I'm getting mail even when the user logged in ...
-4
votes
1answer
28 views

Blackjack Program [closed]

Blackjack Program Blackjack is a card game, the object of which is to be dealt cards having a higher count than those of the dealer up to but not exceeding 21 For this program, you are going to do a ...
1
vote
0answers
21 views

What will be the output when using pass-by-value-result with parameters such n+1?

Let's say a function $f$ is called with parameter $n+1$. Since I use pass-by-value-result, value of formal parameter will be transmitted to the caller's actual parameter at the end of the call. Let ...
2
votes
2answers
36 views

Textbook on formal syntax (and semantics) of programming languages

I'd like to learn about formal syntax of programming languages: how do we describe the syntax of a programming language and how it should be parsed? How do we assign formal semantics to a parsed ...
1
vote
0answers
120 views

How can I simulate nested WHILE loops in a theoretical programming language to show Turing completeness?

PRE-WORK-POST is a theoretical programming language with the following structure, where P,Q and R are LOOP program: $$\text{PRE} \ P \ \text{WORK} \ Q \ \text{POST} \ R \ \text{END}$$ First $P$ is ...
4
votes
1answer
54 views

Explain the difference between Turing Complete and Turing Equivalence

I'm not sure if I understand the difference between Turing Complete and Turing Equivalent programming languages. A computational system that can compute every Turing-computable function is called ...
2
votes
0answers
32 views

What would you do if the author of a published CS article does not respond to code requests? [closed]

Since reproducibility is a major principle or basic norm of scientific experiments, simulations, and computations, what would you do or what to do if the author of a published CS article does not ...
2
votes
0answers
37 views

Understanding the simulate of an IF loop program through a LOOP program

We have the following operation $\text{IF} \ x_i =0 \ \text{THEN} \ P \ \text{END}$. I want to simulate this using a $\text{LOOP}$ program. Here is what I have: $$\text{IF} \ x_i = 0 \ \text{THEN} \ P ...
3
votes
0answers
44 views

Is there a language which enforces “no escape” of variables?

Many languages with GC perform escape analysis to reduce heap allocations. Is there a language with a "no-escape" construct that tells the programmer during compile time to not escape ...
18
votes
2answers
5k views

Paradox? Pure Prolog is Turing-complete and yet incapable of expressing list intersection?

Pure Prolog (Prolog limited to Horn clauses only) is Turing-complete. In fact, a single Horn clause is enough for Turing-completeness. However, pure Prolog is incapable of expressing list intersection....
3
votes
1answer
64 views

What is considered being proficient in a programming language?

I am a college student looking to get into industry work soon and want to understand what employers consider 'proficient' when it comes to programming languages. Right now, I understand that to mean ...
3
votes
0answers
44 views

Is there a computer language with optional dependent types?

I'm looking for a computer langauge with "dependent types" but... The problem with it having a full implementation is that you end up having to write formal type proofs to get even anything ...
1
vote
1answer
42 views

Is there a formalization for the trade-off between the expressiveness and the speed of a programming language?

I do not have a strong background in theoretical computer science, so the terminology I use may not be the most ideal. Basically the "trend" across programming languages I have noticed is ...
2
votes
0answers
22 views

Coding max as an interaction net

I am reading Yves Lafont's introductory paper Interaction Nets. Early in the beginning he mentions that max cannot be coded as follows since in this coding it is not possible to choose which argument ...
0
votes
0answers
18 views

What is the Memory Bandwidth Usage in a Program Related to?

We can use performance counter tools to check the memory bandwidth usage while a program is running. I want to ask what is this memory bandwidth related to? What parameters are involved in memory ...
2
votes
1answer
30 views

printf(“%d”,~5); prints out -6 why is that?

I was reading the book "Computer systems: A programmer's perspective" and saw that the operator, "~", is a NOT operator. When I use it to NOT positive integers, it returns the ...
26
votes
3answers
6k views

Is there any reason why the modulo operator is denoted as %?

I would like to know if there is any reason why many programming languages use the notation % for the modulo operator? It is used in the most "famous" ...
0
votes
0answers
21 views

formal definition of lexical scope

I wonder if there is a formal definition of lexical scope so that people can prove things with respect to it, for example, that an interpreter implements lexical scope. You may ask what level of ...
0
votes
1answer
14 views

Subclass specification

From http://web.mit.edu/6.031/www/fa19/classes/12-interfaces-enums/#implementing_generic_interfaces "That means B is only a subtype of A if B’s specification is at least as strong as A’s ...
1
vote
0answers
18 views

Unifying object oriented language

I'm not sure if this is off-topic but I was thinking about the following: many modern (object-oriented) programming languages are very similar at their core, i.e. they share language features like ...
0
votes
0answers
27 views

Function notation/mapping for this type of functions?

In short, what is the proper function notation/mapping for this type of functions? From Wikipedia regarding maps: In the communities surrounding programming languages that treat functions as first-...
2
votes
1answer
62 views

What are the most used statements in programming (ranked)?

I was wondering if there are any resources for a study/ranking of the most frequently used statements (by statements I mean assigning, invoking, instantiating etc, like in C#) in programming overall (...
-1
votes
1answer
19 views

Random numbers with condition in matlab

I need ’n’ random numbers that: each one is bigger than ‘a’ their sum is smaller than ‘b’ How can I have that in Matlab?
0
votes
0answers
25 views

Are there any beginner-friendly courses teaching how to create a programming language?

There are many excellent step-by-step courses (free and paid) teaching you how a specific programming language works and how to use it to create applications. I've benefited a lot from these courses. ...
9
votes
1answer
846 views

Monad in Haskell programming vs. Monad in category theory

I have a question about concept of monad used in Haskell programming and category theory in math. Recall in Haskell a monad consists of following components: A type constructor that defines for each ...
0
votes
1answer
49 views

I want to learn more about computer science. Where should I start?

Hello computer scientists, I am a mathematician. I have taken some undergraduate courses in C++, Python, assembly language, boolean algebra, logic, graph theory, etc. I would like to learn more about ...
2
votes
1answer
65 views

How does the undecidability of Extensional Martin-Löf Type Theory apply to real type-checking compilers?

It is claimed in many sources (for example, here) that adding a rule like "if Id(X,Y) then X really equals ...
3
votes
1answer
25 views

How would you model Rust procedural macros?

In Rust programming language one can write a compiler extension function that works on abstract syntax tree, effectively modifying source code before it gets converted into machine instructions. In ...
-1
votes
1answer
34 views

Java programming object terminology

Say there is a class called Person. Then in the following expression : Person human = new Person() Which is the "reference&...
-1
votes
1answer
47 views

doubts on cin and scanf [closed]

i spent literally 5hrs trying to figure out, why the value of n is 1 for my second test case ( which begins at line 12 ) , but i am unable to, could you help me with that? ...
0
votes
1answer
23 views

Can you use binary files to reverse engineer cpu architecture?

I wanted to know if it was possible to add code directly to a computer without an operating system or any programming language. To do that, I thought that maybe I could use the binary files to reverse ...
2
votes
1answer
69 views

Type-checking function calls with functional subtyping

I'm relatively new to the topic. Suppose that you want to type-check an expression of the form f(a), i.e. a function call. Assuming that all the declarations are ...
0
votes
0answers
20 views

How would I convert separate digits to an actual number?

In Dr. Racket, how would I combine the digits w, x, y, z to wxyz (for example 3, 7, 8, 9 to 3,789)? I haven't gotten very far on this: (define digits-to-numbers w x y z)
1
vote
1answer
35 views

what are the weakest preconditions of these following statements

what is the meaning of postcondition and weakest postcondition in terms of programing and what are weakest postconditons of following statements. ...
0
votes
0answers
26 views

Regular expressions accepted by programming languages but are not regular [duplicate]

The below definition of Regular Language is given in Wikipedia. In theoretical computer science and formal language theory, a regular language (also called a rational language) is a formal language ...
20
votes
5answers
4k views

What is the formal, rigorous definition of a programming language?

In programming language theory, people study the theory behind programming languages. But I have never heard any formal definition of programming languages themselves. What is the formal definition, ...
3
votes
0answers
50 views

Semantics of “write-once” variables for complex data structures

Question My use case for what is described below is not a language or compiler implementation, but finding a reasonable semantics for this feature in a an abstract calculus. Ideally, you give me a ...
0
votes
2answers
79 views

Are C standard library functions considered part of C programming language

Do we consider functions like printf part of C language even if it's not a keyword in it.
0
votes
1answer
37 views

First-order mutual-recursive functions Turing-complete or incomplete?

Assume we have a C-like programming language with no pointer/heap semantics (i.e. there is no concept of memory; everything is on the stack). The only datatype supported is Integer, but suppose the ...
1
vote
1answer
48 views

Terms for different models of sum types

There seem to be at least a couple different possible ways of modeling sum types in a type system, but I haven't been able to find consistent terms for referring to them: A sum type is formed from a ...
1
vote
1answer
42 views

In the dataflow programming paradigm programs are modeled as directed graphs. Are the edges of the graph variables? And are the vertexes functions?

As I understand it in dataflow programming, programs are structured as directed graphs, an example of which is below Is it true to say that the arrows (or edges) represent the variables within a ...
2
votes
0answers
62 views

What's the meaning of linguistics?

In the programming language theory world, there are two important terminologies, i.e syntax, and semantics. I can understand these two terminologies: syntax is about sentence's structure (e.g. a valid ...
1
vote
2answers
46 views

What programming language should I use to run physics simulations of CO2 being absorbed by different materials?

I want to model the absorption of CO2 with multiple different materials such as cement, limestone, wood, etc? I know Matlab is capable of these types of physics simulation according to this research ...
2
votes
1answer
79 views

How to view Graph Reduction/Graph Representation for a Haskell program?

I know that under the hood, for a Haskell program, the GHC compiler uses graph reduction for optimization. Is there any way to view this graphical representation of the program? I haven't been able to ...
0
votes
0answers
61 views

What does it take to create a new programming language and its toolchain?

I am super novice to this topic, so my apologies if my question looks completely nonsense to you all! Imagine you want to create a new programing language that transpiles to a more common high/low-...
0
votes
0answers
26 views

Exceptions from exceptions, does such a thing exist?

I am intrigued: In many languages there are both normal control flow and exceptions. But I never saw "an exception from an exception" or "an exception from an exception from an ...
18
votes
6answers
7k views

Why do more powerful programming languages tend to have slower implementations?

I was reading this article. The author talks about "The Blub Paradox". He says programming languages vary in power. That makes sense to me. For example, Python is more powerful than C/C++. ...
0
votes
0answers
25 views

Question regarding definition of recursive function

According to Wikipedia, and also a very common definition of a recursive function found in several books, "functions that call themselves from within their own code". I agree that this solves the ...
6
votes
3answers
895 views

Where should I start to understand how computers work? [duplicate]

I am interested in how computers work but I have no idea how the concept of 0's and 1's converts to making possible for people to control a computer by programming. I would like to understand from ...
1
vote
2answers
112 views

Do there exist coding languages where the halting problem is solvable but not trivial

Does there exist a coding language where 1. It is always possible to determine whether a computer program will halt or run forever. And 2. The answer is not always yes. (or always no) So languages ...

1
2 3 4 5
18