Questions tagged [language-theory]

93 questions
123
votes
11 answers

What is the exact problem with multiple inheritance?

I can see people asking all the time whether multiple inheritance should be included into the next version of C# or Java. C++ folks, who are fortunate enough to have this ability, say that this is like giving someone a rope to eventually hang…
Vlad Gudim
  • 22,473
  • 16
  • 66
  • 91
83
votes
1 answer

The recognizing power of "modern" regexes

What class of languages do real modern regexes actually recognise? Whenever there is an unbounded length capturing group with a back-reference (e.g. (.*)_\1) a regex is now matching a non-regular language. But this, on its own, isn't enough to match…
tobyodavies
  • 23,274
  • 5
  • 37
  • 56
50
votes
4 answers

Is HTML a context-free language?

Reading some related questions made me think about the theoretical nature of HTML. I'm not talking about XHTML-like code here. I'm talking about stuff like this crazy piece of markup, which is perfectly valid HTML(!)
user123444555621
  • 130,762
  • 25
  • 104
  • 122
47
votes
7 answers

Can all iterative algorithms be expressed recursively?

If not, is there a good counter example that shows an iterative algorithm for which there exists no recursive counterpart? If it is the case that all iterative algorithms can be expressed recursively, are there cases in which this is more difficult…
eljenso
  • 15,950
  • 6
  • 53
  • 62
47
votes
6 answers

Exactly what is the difference between a "closure" and a "block"?

I've found that lots of people use the words closure and block interchangeably. Most of these people can't explain what they're talking about. Some Java programmers (even ones from really expensive consultancies) talk about anonymous inner classes…
31
votes
12 answers

Learning Resources on Parsers, Interpreters, and Compilers

I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: Does anyone know of…
25
votes
6 answers

what exactly is a "register machine"?

From http://code.google.com/p/unladen-swallow/wiki/ProjectPlan I quote: "Using a JIT will also allow us to move Python from a stack-based machine to a register machine, which has been shown to improve performance in other similar languages…
23
votes
6 answers

The while language

For my theory of computing languages class, we got a homework assignment to implement a piece of code in a language that only has while statements for flow control (no if statements). This is mainly to prove that you can write a Turing-complete…
Jason Baker
  • 171,942
  • 122
  • 354
  • 501
21
votes
8 answers

often used seldom defined terms: lvalue

What is an lvalue?
u6022
20
votes
6 answers

What is the advantage of having this/self pointer mandatory explicit?

What is the advantage of having this/self/me pointer mandatory explicit? According to OOP theory a method is supposed to operate mainly (only?) on member variables and method's arguments. Following this, it should be easier to refer to member…
Piotr Dobrogost
  • 38,049
  • 34
  • 218
  • 341
19
votes
9 answers

Reason for precedence of instanceof/is

In both C#/Java the operator precedence of is respectively instanceof leads to some ugly necessary parenthesis. For example instead of writing if (!bar instanceof Foo) you have to write if (!(bar instanceof Foo)). So why did the language teams…
Voo
  • 26,852
  • 9
  • 70
  • 145
18
votes
4 answers

What is the theory behind mutable and immutable types?

One of the things that I admire about Python is its distinction between mutable and immutable types. Having spent a while programming in c before coming to Python, I was astonished at how easily Python does away with all the complexities of pointer…
jsau
  • 777
  • 5
  • 11
16
votes
2 answers

SLR(1) Parser and epsilon involved

Let's suppose I have the following grammar: S → X X → a | ϵ If that grammar wouldn't have ϵ involved, I would construct the first state like: S' → .S S → .X X → .a but what about the ϵ symbol? Should I include: X → .ϵ too? If so... when…
Oscar Mederos
  • 26,873
  • 20
  • 76
  • 120
16
votes
13 answers

Regular expression for strings with even number of a's and odd no of b's

Im having a problem in solving the problem:- Its an assignment, i solved it, but it seems to be too long and vague, Can anyboby help me please...... Regular expression for the strings with even number of a's and odd number of b's where the character…
Abu Mathew
  • 177
  • 1
  • 1
  • 3
15
votes
5 answers

Besides Logo and Emacs Lisp, what are other pure dynamically scoped languages?

What are some examples of a dynamically scoped language? And what are the reasons for choosing that design? Is it because it is easy to implement?
unj2
  • 47,759
  • 80
  • 235
  • 362
1
2 3 4 5 6 7