Questions related to design, implementation, and analysis of programming languages

learn more… | top users | synonyms (1)

1
vote
1answer
33 views

Trace dependents & precedents of a program in an imperative language

We have some programs in a very basic imperative language, the programs contain some basic features: assignment, condition, loop, scalar variables, 1-dimensional arrays and 2-dimensional arrays... ...
0
votes
0answers
23 views

Confusion regarding pointer! [migrated]

I was watching a lecture and got confused at a point when professor said that ptr=&x denotes a variable ptr assigned the address of the variable x. And for ...
0
votes
1answer
56 views

Register Machine code for Fibonacci Numbers

I am not sure whether this is the right place to ask this question. I would like to write a register machine code which when given an input of n in register 1, returns (also in register 1) the nth ...
-3
votes
0answers
42 views

Landing the dream job after college [closed]

I have a concern with something that college has not prepared me for. I am two semesters away from graduating as a Software Engineer and I want to land a job in my field of study. I run a small web ...
-3
votes
0answers
41 views

C++ Polynomial Multiplication [closed]

\begin{eqnarray} \text{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \end{eqnarray}\begin{eqnarray} \text{IF YOU HAVE A QUESTION, THEN ASK AND I CAN ...
3
votes
3answers
133 views

What is a sort in Programming Language Semantics?

I've started reading Practical Foundations for Programming Languages and in the first chapter, the author mentions that ast's are associated with sorts. Intuitively, sorts are like types, but I'd like ...
-1
votes
0answers
11 views

how to access a html variable in php [closed]

Following is an html code for form creation Username In this I have to assign some value to variable username in php. How do I do that? How to access the variable in php?
3
votes
0answers
65 views

How to eliminate for/if/while from algorithms when it's possible

Is there any way to find out how to replace for/if for elementary recursive algorithms? I know that primitive recursive functions cannot basically eliminate "for", but for elementary recursive ...
5
votes
2answers
234 views

What is, exactly, $\lambda$-calculus?

I'm starting an undergraduate computer science course next fall, but I can't really understand λ-calculus in the context of functional programming. I may be misinterpreting this completely, but based ...
4
votes
1answer
56 views

What is the difference between the semantic and syntactic views of function types?

Edit: My original question referred to nonconstructive and constructive definitions of function types. I changed the terminology in the question and the title to semantic and syntactic, which the ...
0
votes
0answers
27 views

Turing machine help

I was having a hard time understanding and solving this question that wants me to show the final tape and figuring out if whether or not the turning machine accepts it or not. I have a list of 20 ...
1
vote
2answers
44 views

Turing completeness

I encountered the brainfuck programming language which I know is turing complete. However I then decided to create a high level language that gets compiled to brainfuck code. There is only one data ...
1
vote
1answer
54 views

How to write stack programs for arithmetic terms?

I have been given a question about a stack program which I can not solve. Write a stack program to evaluate the term $\qquad (((A+B)-(A*B))*C)/(((A-B-C))⁄2)$ How ...
3
votes
5answers
294 views

Why do negative array indices make sense?

I have came across a weird experience in C programming. Consider this code: ...
1
vote
2answers
146 views

Why is there no two-bit data type?

Why do most programming languages (if not all) lack a 2-bit data type? A boolean is a single bit with the values being either true or false. Why is there no native, corresponding type where the ...
6
votes
1answer
84 views

How are data types related to information theory?

I was just reading from wikipedia the following about information: From the stance of information theory, information is taken as a sequence of symbols from an alphabet, say an input alphabet χ, ...
5
votes
4answers
167 views

What is the exact relation between programming languages and Turing machines?

I don't know much about yacc, bison, flex or lex and please correct me if I'm wrong but a programming language is also a Turing machine and a Turing machine is defined as the tuple $(Q, \Gamma, b, ...
1
vote
1answer
35 views

Mutable Object Values in a Functional Interpreter

I am writing a functional style interpreter for a non-functional programming language that supports both primitive and object values. Primitives are passed by value while objects are passed by ...
1
vote
1answer
59 views

A program that cannot be written in (simply-)typed lambda calculus but only in lambda calculus or Turing-complete language

Programmers do sometimes write a program that creates infinite loop if some particular input is passed into the program. But Simply-typed lambda calculus has to stop - so the question is, can anyone ...
3
votes
1answer
33 views

ML - Type Interface

From my recitation class - Can you please explain why does operator $"+"$ signature is $ int \rightarrow (int \rightarrow int)$ ? How does this graph is build ? And what is mean $t=u ...
1
vote
3answers
91 views

How does interpreting a script work?

Suppose I have a script (.vbs, for example) that is stored in a file. How does the code in the file get converted into machine instructions? What is between the ...
2
votes
1answer
25 views

How is the following ML Curry expression evaluated

This question is not homework but it's related to material in a general course I take about programming languages, so I don't know whats the site policy about this In ML the following expression: ...
5
votes
2answers
85 views

Formally describing a sensor network language

I have a language for sensor networks (generates C code) and I want to define the formal semantics of it. The language has this form: ...
10
votes
3answers
166 views

What is the relation between functors in SML and Category theory?

Along the same thinking as this statement by Andrej Bauer in this answer The Haskell community has developed a number of techniques inspired by category theory, of which monads are best known ...
9
votes
2answers
206 views

How are programming languages and foundations of mathematics related?

Basically I am aware of three foundations for math Set theory Type theory Category theory So in what ways are programming languages and foundations of mathematics related? EDIT The original ...
-3
votes
1answer
30 views

GCC compiler for C and other languages [closed]

I have gone through many reference documents about how a GCC compiler optimizes program. But I am not sure how actually a programmer request GCC attempt to optimize a program. Plz help answering this ...
0
votes
1answer
31 views

Difference between Normative annexes and Informative annexes in ADA 95

I was reading the ADA 95 reference manual. I came across these two words in annexes Normative and informative . I couldnt find the difference between those. Your help will be much appreciated.
6
votes
3answers
138 views

anonymous lambda functions (functional programming)

What are anonymous (lambda) functions? What is the formal definition of an anonymous function in a functional programming language? In my simple terms, when I am programming in scheme/lisp I would ...
5
votes
2answers
107 views

Clear, intuitive derivation of the fixed-point combinator (Y combinator)?

The fixed-point combinator FIX (aka the Y combinator) in the (untyped) lambda calculus ($\lambda$) is defined as: FIX $\triangleq \lambda f.(\lambda x. f~(\lambda y. x~x~y))~(\lambda x. f~(\lambda y. ...
17
votes
8answers
616 views

Are programming languages becoming more like natural languages?

Can we study programming languages in the context of linguistics? Do programming languages evolve naturally in similar ways to natural languages? Although full rationality, and mathematical ...
-2
votes
1answer
49 views

Pre and post increments in C [closed]

void main() { int a = 1; a = ++a + ++a + ++a; printf("%d",a); } the above program gives the output 12. What I have understood is that the variable 'a' is incremented thrice before it is ...
0
votes
1answer
121 views

Regarding programming languages, what is meant by “hook”?

My professor gave this assignment question, where he asks us to compare the expressive ease and the expressive range of Low Level and High Level theoretical programming languages. While in context, I ...
4
votes
1answer
117 views

What would be the classification of R according to paradigms?

I would like to know in which classification is the R programming language. It has elements of the imperative paradigm and object oriented paradigm (some things like that even a number is an object ...
4
votes
1answer
67 views

Type inference in compiler is context sensitive?

Have read in Compiler textbook that type inference is context sensitive. Can anyone explain why is it so? This means that we need context sensitive grammar in semantic analysis phase of a compiler ...
0
votes
1answer
29 views

How Does Dynamic Heap Storage Have Something to Do with Heap?

There are three typical ways to allocate memory for programs: static, stack and dynamic heap. However, when I look at the implementation of dynamic heap memory allocation from wikipedia , what I found ...
5
votes
3answers
241 views

Can someone give a simple but non-toy example of a context-sensitive grammar?

I'm trying to understand context-sensitive grammars. I understand why languages like $\{ww \mid w \in A^*\}$ $\{a^n b^n c^n \mid n\in\mathbb{N}\}$ are not context free, but what I'd ...
2
votes
2answers
157 views

Finding the grammar type of the programming language

How can someone find what type of grammar for a given programming language? Formerly I'm looking for a grammar type for most popular programming languages: C, C++, C#, Java, List, OCaml, Haskell etc. ...
-2
votes
1answer
159 views

C code fragment [closed]

In the following C program fragment, j, k, n and TwoLog_n are integer variables, and A is an array of integers. The variable n is initialized to an integer $\ge3$, and TwoLog_n is initialized to the ...
0
votes
3answers
120 views

Which would provide a stronger base for future learning? C vs C++ [closed]

I've studied C++ for about a year now independently, having an initial goal of the usual "i want to program video games" to a new found goal of pursuing computer science as a full time career. ...
0
votes
1answer
128 views

Help in find new topic for master thesis [closed]

Can any body help me for new idea in AI (artificial intelligence) I can implemented in master thesis ? For example AI with Networks ? AI with Email System AI with GIS
0
votes
1answer
112 views

What is the difference between control flow graph & interprocedural control flow graph?

I am doing research on control flow analysis on aspect oriented programs and I found in some papers an interprocedural approach for doing control flow analysis on others call graph or control flow ...
3
votes
1answer
115 views

Scala as a language for Generic Programming

I posted the same Q at programmers.SE, but nobody really helps. In the paper “An Extended Comparative Study of Language Support for Generic Programming” by Garcia et al. an interesting comparison of ...
3
votes
1answer
115 views

A programming language that can only implement computable bijective functions?

Are there programming languages(or logic) that can implement(or express) a function $f:\mathbb{N}\to \mathbb{N}$ if and only if $f$ is a computable bijective functions?
3
votes
2answers
185 views

Don Knuth and MMIXAL vs. Chuck Moore and Forth — Algorithms and Ideal Machines — was there any cross-pollination / influence in their ideas / work?

Question: To what extent is it known (or believed) that Chuck Moore and Don Knuth had influence on each other's thoughts on ideal machines, or their work on algorithms? I'm interested in citations, ...
5
votes
3answers
413 views

Call by value-result vs. call by reference?

From my Googling, it appears that call by value-result is similar to call by reference in that it changes values in the caller, but it's different in that the changes don't take place until the callee ...
1
vote
2answers
208 views

Definition of the state of an object in OOP

I need a concise definition of the "state of an object" in object-oriented programming (for a paper). For about half of a day I searched for a paper that I can cite on this topic, but I couldn't find ...
-1
votes
1answer
74 views

Why have two functions, exec and execv? [closed]

What is the use of having two exec functions like execv and exec? what I mean is why would ...
4
votes
1answer
69 views

Instruction Translation

Imagine two machines of different architecture which produce output of a standard format. If you have a program for one machine and can observe it's operation and output, what techniques exist to ...
3
votes
1answer
119 views

What is the difference between operator and function?

We have operator and operands, function and formal arguments. Is the difference purely lexical (we use alphanumerics for funciton identifiers but identify operators with special characters, e.g. "+" ...
0
votes
1answer
66 views

Flow of control? or Control of flow?

In most PL textbooks (even in language specifications) statments like if, while, for, break are categorized as flow of control statements. However, it is not consistent; i.e. sometimes the same text ...

1 2 3