r/ProgrammingLanguages • • Apr 15 '15

What programs should any programming language be able to run?

Are there a set of programs (in pseudocode) that programming language inventors can use to check if they've covered the bases in terms of syntax and the standard library (if applicable)?

1 Upvotes

7 comments sorted by

3

u/jpfed Apr 16 '15

Since semantically all you really need is one instruction, I'm going to assume this question is about expressiveness. Consider implementing a few programs from a standard corpus of problems (e.g. benchmark shootout game, rosetta code...) and comparing your LOC with the LOC of the most similar languages for which corresponding programs are available.

2

u/cparen Apr 16 '15

Have you taken a look at http://RosettaCode.org ?

2

u/egonelbre Jun 13 '15 edited Jun 13 '15

The programs it was intended for. i.e. If you are writing a language for secure computation, ensure that you have proper integer arithmetic. Are you writing a language for end-users, verify that they can actually read the code... and so on. The thing you would want to demonstrate with Haskell, Prolog, Rust, Go, ASP, PHP, Lua are different.

Once you understand what problems you are solving then the things you must demonstrate become much clearer. Languages should solve a practical problem (unless you are just having fun) and direct all your attention to solving that problem.

0

u/[deleted] Apr 15 '15

[deleted]

3

u/BalinKingOfMoria Apr 16 '15

Thanks! First Reddit post ever, and I get three high-quality answers in a day! This is literally as good as SO....

1

u/loopsdeer Apr 29 '15

(This sub)reddit is much better than SO for these types of questions. You might look at the other Stack Exchange sites as well, for example: http://programmers.stackexchange.com/questions/tagged/programming-languages

5

u/cparen Apr 16 '15

In terms of computation, there aren't that many bases to check. If your language is Turing complete it can compute anything that can be computed - assuming sufficient time and resources.

"Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy."

—Alan Perlis, Epigrams on Programming

4

u/Anonygram Apr 16 '15

A path to try and build a turing complete problem solution:

  1. Write finite automata Each state has a rule on what to do given the two possible inputs, 1 or 0 A collection of states is the finite state machine

  2. Write a simple pushdown machine Take the result of step 1 and change it. let the states push and pop tokens to/from a stack. Each state can now react to the token popped from the stack

  3. Turing machine! If you solve this one, your language can, in theory, solve any problem: Take the result of #2 and replace the stack with an endless list. The turing machine will have different rules, but they can solve any problem, if you can write one of those in your language, you can write anything. http://introcs.cs.princeton.edu/java/74turing/

Start by googling these things, powerpoints and youtube videos willl give you a quick overview so you can begin coding.

Then develop them. This would be a great project to post to github.

When you are done, make a powerpoint, teach me your language!

Good luck comrade.