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

An infinite loop by using break, define the user input( Enter a password:) and if the number equals to 15 (success) otherwise (Try again!) [closed]

If you enter a password in your university account and at any time you enter the wrong password, the ask for the right password to do that you will be creating: An infinite loop by using break, ...
Amanaaaaaa's user avatar
0 votes
1 answer
21 views

Results of a Program After Call By Reference Vs. Call By Value-Result

I have a question that I am trying to work through. I have a program: ...
RDizzl3's user avatar
  • 101
0 votes
1 answer
30 views

Guess the output of a c program [closed]

I have come across a c program like this . int main() { int a,i=4; int z=5; a=--i+ --i+ --z; printf("%d %d",a,i); return 0; } What will be the output? I need some explanation.
Shahed al mamun's user avatar
-1 votes
0 answers
8 views

I need help plotting a 3D trajectory field for a 3x3 matrix [closed]

I'm trying to plot the trajectories of a 3x3 matrix. I can do this on the 2D plane but cannot get it to work on the 3D plane as needed for a 3x3 matrix. When I try to use from sage.plot.streamline ...
user164686's user avatar
1 vote
2 answers
46 views

In the simulation of a C-program by a Turing machine, how does a TM determine which instruction to execute?

In Arora-Barak, the authors mention a way how TMs can compute everything that can be computed by computers. The idea is that every high-level language program has an equivalent machine language ...
Burt Macklin's user avatar
0 votes
0 answers
56 views

What is the earliest compiler in chain that was used to create what we nowadays have as a modern C compiler?

My apologies if the title is confusing. First I begin with the statement that may be wrong but what I always thought what happened. "Dennis Ritchie created C compiler which was used to create ...
Clear Sky's user avatar
1 vote
0 answers
25 views

A formula of the major garbage collection threshold

I'm studying the garbage collection code of Alex Aiken's COOL programming language's runtime system. (This is the language used in a relatively famous Stanford Online Compilers course) A major garbage ...
Myk's user avatar
  • 173
0 votes
1 answer
58 views

How to evaluate an arbitrary mathematical expression

For Instance, if I allowed the user to pass in expressions like "35 + 2 * 5" as strings, how would I go about writing such a program? Also, what topics does this question fall under?
Enoch's user avatar
  • 11
3 votes
1 answer
167 views

how to do incremental construction of the minimal model in logic programming?

I was reading a book titled "Essentials of Logic Programming.", most parts of the book are easy to understand. but now having a problem with Theme 45: incremental constructions of the ...
alim's user avatar
  • 984
1 vote
0 answers
27 views

Is it possible for Mojo language to include multiple dispatch feature of Julia through some hints or decorators mechanism? [closed]

Can the strengths of Mulitple Dispatch system of Julia language be replicated in a newly designed language like Mojo through cleverly designed mechanism? Or only Julia gets to have such a feature due ...
user238607's user avatar
0 votes
2 answers
78 views

Can you verify the end of a function declaration through syntax analysis?

In some languages, it is expected that a function declaration be terminated by syntax that includes the function name. For example, in MODULA-2, a function is declared as shown below: PROCEDURE P ; ...
Emma3201's user avatar
1 vote
2 answers
64 views

Datatypes and number representaton

I'm a freshman in computer science and I have a question that has been bugging me after my programming and electronics classes were over. My question is that in an integer datatype (assume short ...
WhizzingPhoton's user avatar
0 votes
0 answers
45 views

Metaprogramming language

Is there any programming language, by which I can write a code that during run time automatically generates so many other codes and furthermore those codes will be run in parallel?
DYNAMICS's user avatar
0 votes
1 answer
51 views

Show that if <S1;S2,s> => * s', it is not necessarily the case that <S1,s> =>* s'

I am studying Structural Semantics for programming languages and I have come to this proof that I can not achieve. Whith these rules plus Splitting and No interference, I am trying to get a proof. I ...
Francisco Aguilera's user avatar
1 vote
4 answers
3k views

Can we ever achieve Turing completeness?

I want to relate Turing completeness to the Halting Problem. As far as I know we say something is turing complete (eg: a programming language) when it can compute any function and can do any task. But ...
D Star Let's Explore's user avatar
5 votes
7 answers
3k views

What are the conditions necessary for a programming language to have no undefined behavior?

For context, yesterday I posted Does the first incompleteness theorem imply that any Turing complete programming language must have undefined behavior?. Part of what prompted me to ask that question ...
Mikayla Eckel Cifrese's user avatar
2 votes
3 answers
288 views

Does the first incompleteness theorem imply that any Turing complete programming language must have undefined behavior?

If I understand correctly, the first incompleteness theorem says that any "effectively axiomatized" formal system which is consistent must contain theorems which are independent of the ...
Mikayla Eckel Cifrese's user avatar
1 vote
0 answers
23 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
2 votes
1 answer
99 views

What is the closest theory to "The theory of code refactoring"?

We refactor code lots of times as developers. Metaphorically, our program space is an infinite-dimensional Rubik's cube. Things can be rearranged, preserving the code's action, so a "symmetry ...
Daniel Donnelly's user avatar
1 vote
1 answer
30 views

Algorithms/Data-Structures to calculate transitive call graphs in the presence of virtual dispatch?

Algorithms/Data-Structures to calculate transitive call graphs in the presence of virtual dispatch? I am trying to write a program to analyze Java programs and figure out the transitive closure of the ...
Li Haoyi's user avatar
  • 125
10 votes
3 answers
2k views

Is there a theoretical foundation behind CSS?

You know how programming languages can be based on Lambda Calculus or the Turing Machine and SQL is based on relational algebra. Is there any such thing for CSS or any foundation that could be used ...
Juan's user avatar
  • 755
0 votes
0 answers
23 views

How does tokenization relates to formalism, lexical grammar, and regular language?

I am reading Bob Nystrom Crafting Compiler's and in the chapter 5 it says this In the last chapter, the formalism we used for defining the lexical grammar— the rules for how characters get grouped ...
Finlay Weber's user avatar
0 votes
1 answer
105 views

What does it take to support a programming language on an OS?

From my understanding, something like Linux is very geared towards C programs, with things like libc. What I'm wondering is, even in Java, you have arguments to ...
user129393192's user avatar
0 votes
1 answer
66 views

Explanation of a simple example of how an interaction net computes?

I have briefly looked through the links at the bottom of this page: Interaction Nets Interaction Combinators Implementation of a low-level language for interaction nets, Shinya Sato Inpla, ...
Lance's user avatar
  • 2,163
1 vote
0 answers
38 views

Difference between structural and derivation induction

I am currently reading the book "Programming Languages and Types" by Benjamin C. Pierce. The myriad usage of many different kinds of inductive proofs has started to confuse me a bit. For my ...
Mepep's user avatar
  • 11
0 votes
0 answers
71 views

What are fundamental differences between single dispatch and multiple dispatch?

How do single and multiple dispatch differ? In particular, I am wondering why some programming languages, both interpreted and compiled (such as Python and Java), natively support single dispatch but ...
user's user avatar
  • 131
2 votes
0 answers
16 views

Does exist another models like CARDIAC, LMC and IPC?

I'm working with CARDIAC (Cardboard Illustrative Aid to Computation) that is a model created at Bell Labs in 1968 to explain students how the computers worked with the Von Neumann architecture to ...
Osvaldo Santos's user avatar
0 votes
0 answers
21 views

Problems with writing short job first algorithm(for scheduling of processes) in C language

Hy everyone. I'm trying to write the SJF (short job first) algorithm NON-PREEMPTIVE for scheduling processes in C. I want to implement an algorithm that orders some processes by the burst of the ...
Enri's user avatar
  • 1
9 votes
7 answers
7k views

Why do we use main function in almost all the programming languages?

Why do we need the main function and can't we execute the code without it? Can't we just execute our code outside the main function by making our own function?
Kakashi San's user avatar
0 votes
1 answer
27 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
5 votes
2 answers
634 views

Structural equivalence of self-referential structures

Given two types, T1 and T2, how does structural equivalence work when they're self-referential? Further, how do we go about proving it? ...
HidekiRyuga's user avatar
0 votes
0 answers
65 views

Function types in Computer Science Metanotation

See Guy Steele's slides for what I refer to by "Computer Science Metanotation", specifically the bits about BNF. I often make use of the BNF syntax observed there, as a substitute for ...
Sebastian Graf's user avatar
0 votes
2 answers
35 views

Discarding lists of same elements

Suppose, I have a list of lists where multiple lists can have same elements. In my final output, I just want one list with the same element. An example is the following: Input: A=[[1,2,0], [0,1,2], [2,...
Becker Mammat's user avatar
0 votes
1 answer
67 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
3 votes
0 answers
79 views

Formalize the proof of theorem 2.4 in Harper's PFPL

In Harper's Practical Foundations for Programming Languages, page 19, rule (2.9) defines the $sum$ function inductively. $$ \frac{b:nat}{sum(zero;b;b)}\tag{rule 2.9a} $$ $$ \frac{sum(a;b;c)}{sum(succ(...
gingerologist's user avatar
2 votes
1 answer
62 views

Is there any formalization of GADTs implemented in OCaml?

There are papers that describe how generalized algebraic datatypes (GADTs) are encoded in core Haskell (System FC)[1][2], but I could not find any documentation on how OCaml formalizes/implements/...
Apoorv's user avatar
  • 659
-2 votes
1 answer
57 views

How a computer works?

I know that a computer can be mechanical, screws/nuts or even water/pipes. Of course, it would be slow and big, but it doesn't have to be electric, transistors, etc. How can a machine like this do all ...
user157635's user avatar
1 vote
2 answers
85 views

Division by zero in APL: assign return value 0 or 1

Recently I began learning a couple array based programming languages: Dyalog APL and BQN. And I cam across this peculiar manner in which division by zero is handled in Dyalog APL. Using the in-built ...
oliverjones's user avatar
1 vote
1 answer
36 views

Example of preservation failing in Java - follow up question

This is a follow-up question to my previous question I have been reading this post and it comes up with the following example showing how Java type system is unsound: ...
Node.JS's user avatar
  • 101
0 votes
2 answers
46 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
1 vote
2 answers
133 views

Example of progress and preservation failing in a commonly used programming language like Java

I am wondering if my solution is correct or I am on the right track. I have searched online and found a paper about Java type system being unsound but that doesn't really answer the progress and ...
Node.JS's user avatar
  • 101
0 votes
0 answers
36 views

Programming language implementation challenge: is recursion harder than HOFs, or vice versa?

(Initially this question was on cstheory, but I was told cs would be a better fit, so posting it here.) All other things being equal, which of the following languages would be more challenging to ...
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
0 answers
51 views

what are all the ways of delimiting blocks

To my knowledge, in block-structured programming languages, there are 2, maybe 3 main ways of delimiting a block. Using start and end tokens, this can be brackets or reserved words etc Using ...
StackMachine's user avatar
0 votes
0 answers
70 views

Semantics Equivalence of Structural Semantics of While Programming Language

I'm taking a course about the formality of programming languages and while reading Semantics with Applications: An Appetizer by H.R Nielson and F. Nielson I came across the following exercise: I'm ...
MiddleEasternPrince's user avatar
0 votes
0 answers
19 views

Reference request: Domain specific language, runtime, virtual machine design and implementation

I'm a working software engineer who is interested in programming language design and I want to try to implement a simple DSL as an exercise and a side project. I want to apply for grad school in this ...
Kelvinyu1117's user avatar
0 votes
1 answer
37 views

Regular grammar such that it rejects keywords

I want to write a regular grammar that follows the C language. I almost wrote the grammar, but was not able to resolve how to define a variable. Def: A variable can be any combination of characters, ...
NIKHIL's user avatar
  • 1
0 votes
1 answer
64 views

Why is Javacript's Object not a primitive data type?

If javascript's object is just associative array, what makes it non-primitive as they have labeled it? It is certainly already built in. Its not like I'm creating my own concrete implementation of ...
cozycoder's user avatar
  • 123
3 votes
1 answer
205 views

Is “x' = f(x)” a programming paradigm?

I'm the author of GateBoy (a gate-level simulation of the original Game Boy hardware) and Metron (a C++ to Verilog translation tool). One big issue I had to work around for both projects is the ...
tanjent's user avatar
  • 66
1 vote
1 answer
81 views

Programming language compiler that will perform the composition of primitive functions with optimization

Is it possible to create a some programming language compiler that will perform the composition of primitive functions with optimization? In fact, the maximum possible optimization in the context of ...
user51515151's user avatar

1
2 3 4 5
20