Skip to main content

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
-2 votes
1 answer
49 views

How to write the Python Program for the following condition?

How to write a Python Program for the following condition: Let me explain how I tried to write the code. $a=$ int$($input$($'enter the first integer between $1$ and $9$'$))$ $b=$ int$($input$($'enter ...
Mathematics's user avatar
0 votes
2 answers
61 views

How does an interpreted language handle forward references?

An interpreted language is executed one statement at a time, as they are encountered, similar to sequential operations on a calculator. This is as opposed to a compiled language, in which the entire ...
Miss Understands's user avatar
0 votes
1 answer
27 views

What Are The Pre-processing Steps for CNN Text Classification?

I am currently doing a project where I am using a CNN for text classification on tweet data but am unsure of what pre-processing steps need to be taken before the actual model is coded. I can't seem ...
leakie's user avatar
  • 1
0 votes
0 answers
35 views

I am designing my own modular programming language. Am I right on memory management strategy?

To ease memory management in C, I will move OR let all memory allocation of every module of the program into a single function and expect them to be working without problem. I am not sure if it works ...
mostafas's user avatar
0 votes
0 answers
38 views

Why [b] → Int < a → Int holds according to the contravariant manner for function types but length is a counter example for that

In the paper Practical type inference for arbitrary-rank types, the covariance and contravariance rules are essential when dealing with function types. Covariance applies to the return types of ...
SDSD's user avatar
  • 31
2 votes
0 answers
38 views

Reference counting operation insertion in syntax tree

This question might be too open-ended, but I can't seem to find any resources online. When implementing reference counting as a form of GC in a language, how do you know when to increase/decrease ...
lav_shaun's user avatar
0 votes
0 answers
39 views

Completeness of bidirectional type checking by inversion

I'm currently reading through the completeness proof of the paper "Complete and Easy Bidirectional Typechecking for Higher-Rank Polymorphism" by Dunfield et al. In the second case Dunfield ...
a curious student's user avatar
3 votes
2 answers
984 views

Exception handling: 'catch' without explicit 'try'

I'm working on a new general-purpose programming language. Exception handling is supposed to be like in Rust, but simpler. I'm specially interested in feedback for exception handling (throw, catch). ...
Thomas Mueller's user avatar
-4 votes
2 answers
127 views

Are my ideas good enough to be hired by programming design groups?

Am I having any chance if I implement a system programming from scratch? I have some ideas. The first is to fix malloc in C. Add a last parameter to all function calls, use LINE and ThreadId and make ...
mostafas's user avatar
0 votes
0 answers
21 views

Compile vs Runtime Binding

I have java code. In first example, it is said that compile time binding is here, But in second example, ...
amangupta's user avatar
1 vote
1 answer
57 views

How to prove a function is a bijection (name mangling)?

I'm writing a compiler for a subset of Java, which does not permit overloading (but it does permit overriding). Static functions outside of main are not allowed. We'...
user129393192's user avatar
0 votes
0 answers
44 views

What is the difference between software development and software engineering?

What is the difference between software development and software engineering? And What are the foundations of each one of them?
Abdelrahman S. Eltyar's user avatar
0 votes
1 answer
83 views

can programming language be described by ambiguous grammar, if yes, will that cause any problem?

When someone tries to formally describe the syntax of programming languages, they describe with context-free grammar, then for every program we can derive parse tree that would correspond to that ...
math boy's user avatar
  • 381
1 vote
0 answers
64 views

How to convert wp equations into linear algebra equations?

I am reading this paper [1], wherein the authors first formulated a safety constraint in terms of wp equations. Then, they converted the equations into linear algebra form. As per section 4.3, their ...
desert_ranger's user avatar
0 votes
1 answer
43 views

How are PCFGs used in programming language design?

I've been reading the wikipedia article about probabilistic context-free grammars (PCFGs), and they state that PCFGs have application in areas as diverse as natural language processing to the study ...
Knogger's user avatar
  • 1,624
0 votes
3 answers
75 views

Reference types

Is a reference type (agnostic of PL) the object being pointed at, or the object doing the pointing? I'm having a hard time wrapping my head around the concept fundamentally (of course, I have ...
user129393192's user avatar
0 votes
2 answers
79 views

What is the precise difference between state and environment and memory?

I was just reading this question regarding the difference between environment and memory. However, the textbook in question, Essentials of Programming Languages, third edition, by Friedman and Wand, ...
The Pointer's user avatar
1 vote
1 answer
65 views

Creating an executable after code generation - compiler design

I am learning about and building a very basic compiler. My question is about code generation. I have read on a lot of materials about code generation when building a compiler and I get the concept. ...
Ali Ahmed's user avatar
1 vote
2 answers
80 views

How are conflicts between free and bound de Bruijn indices resolved?

On page 77 (section 6.1) of Types and Programming Languages by Benjamin C. Pierce (1st and only edition thus far), there is the following quote regarding naming contexts and de Bruijn indices: Γ = x ...
bbarker's user avatar
  • 175
1 vote
0 answers
146 views

How to deal with missing variables when utilizing weakest precondition for verification?

I am reading the example given in [1], section 4.2. It deals with applying weakest precondition (wp) rules to ensure that the velocity of a car doesn't exceed a certain limit. We have the following ...
desert_ranger's user avatar
3 votes
1 answer
184 views

How did this work apply weakest precondition rule on their example car problem?

While reading the example given in [1]., I couldn't understand how the authors set up the logic to compute the weakest preconditions (wp) in their car example in section 4.2. The dynamics of the ...
desert_ranger's user avatar
0 votes
2 answers
46 views

Returning more than one value from a function without overhead

In stack languages (e.g. PostScript, Forth), return values are passed on the stack - zero, one, even a variable number. Python supports tuples of values there, frequently used "without tuple ...
greybeard's user avatar
  • 1,126
0 votes
0 answers
34 views

Formal Proofs for Rust-related Programming Languages Paper

I've done some PL-related work in Rust that requires some proofs to guarantee the resulting language is free of data races. I'd like to include such work in a paper, but I'm not sure whether I should ...
baffld's user avatar
  • 593
0 votes
1 answer
44 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
-1 votes
1 answer
62 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 ...
Shahed al mamun's user avatar
1 vote
2 answers
72 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
75 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
2 votes
1 answer
52 views

Is there any reference materials on complexity analysis for lazy languages?

Is there any books, papers or articles on how to analyze the time complexity of programs written in lazy languages such as Haskell? I know how laziness is implemented and how it can be expanded and ...
Kagura Hitoha's user avatar
1 vote
0 answers
30 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
107 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
178 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
  • 1,024
1 vote
0 answers
73 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
110 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
70 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
49 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
89 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 ...
Dhanush Sai Baswa'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
367 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
28 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
110 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
44 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
9 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
1 answer
149 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
567 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 Pollard's user avatar
2 votes
0 answers
24 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
9 votes
7 answers
8k 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
35 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
641 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
101 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

1
2 3 4 5
20