8

Some programming languages are modeled on machine code, like assembly languages. Other languages are modeled on a natural language, the English language. Others are not modeled on either machine code or natural language. Languages such as PROLOG, for example, don't follow either model.

I came across this Perl module Lingua::Romana::Perligata, that allows to write programs using a syntax that is very similar to Latin.

Are there programming languages that have less positional syntax?

Are there other languages or modules that allow you to write in syntaxes inspired by other natural languages, like French, Hebrew or Farsi? There is a very long list on Wikipedia, but most of those projects are dead.

There is a related question on StackOverflow. The answer that was accepted is "Use Google".

2 Answers2

2

The only currently used written programming language I can think up off the top of my head is HTML. Now depending on your definition of programming language, this may or may not count.

To help you understand why there is not a lot of high usage programming languages that have less positional syntax you have to understand how most programming languages are designed. Most programming languages are based on unambiguous grammars, mostly by the use of LL and LR grammars. In order to keep the grammars unambiguous most of the technology relies on using the ordering of the symbols and words, e.g. terminals, to make the input unambiguous. What you are looking for are languages that give up position to make the grammar unambiguous. If the compilers cannot use position to decide if the grammar is unambiguous, then the compiler needs some other hints to make the grammar unambiguous, thus prefixes such as #, %, ' and ". Another technique is to associate keywords with each value, i.e. width=10, which is what HTML does. If you create a grammar that does not use LL and LR grammars, then you have to use a different technology to resolve ambiguities which typically use backtracking which requires a large amount of computer processing to resolve the ambiguities.

Declarative languages are closest in general that I know of such as PROLOG and SQL, but again require the use of some positional values.

The only other languages that come to mind are spoken language into AI systems that process the input such as Watson, but again, do you consider this a programming language; if you consider SQL a programming language, then why not a verbal query for Watson.

Guy Coder
  • 949
  • Thank you for the great explanation! I guess that this way the HTML language must have a big number of keywords. I guess that regular expessions on tokens could be used to decide the type of a token. Of course that would make the compiler much slower. – Vitaly Olegovitch Apr 29 '12 at 13:55
  • also, by extension XML could be considered. – alfa64 Apr 29 '12 at 18:35
  • 3
    Might consider Forth, which doesn't have much of a grammar. – Gort the Robot May 22 '12 at 19:46
  • 1
    AFAIK HTML isn't a programming language. – jcora May 22 '12 at 20:19
  • @StevenBurnap yes FORTH is interesting because it just operates on a stack, and so not much grammar is needed. – Vitaly Olegovitch May 22 '12 at 20:25
  • @Bane in the answer is written «Now depending on your definition of programming language, this may or may not count.» – Vitaly Olegovitch May 22 '12 at 20:26
  • 3
    HTML is a markup language; that is what the M stands for, it isn't a programming language because it isn't Turing complete! XML definitely isn't a programming language either. They are data encoding formats! This like saying that a JPEG is a programming language! –  May 22 '12 at 21:56
  • @JarrodRoberson: While you are right, I don't think Turing completeness is a useful criteria to define a "programming language". Particularly, there are some very nice total functional languages that are not Turing complete but are still useful for writing programs (e.g. Epigram or Agda). – Tikhon Jelvis Jun 03 '12 at 21:14
  • @JarrodRoberson But what if the JPEG is a screenshot of C code? :P – back2dos Dec 14 '15 at 22:17
2

Oracle Policy Automation has business rules coded in natural language. It is worth a look.

An example is:

Human Resources Policy 100 – Maternity Leave 

100.1. The employee is eligible for maternity leave if

a. The employee is female and
b. Either
 i. The employee has given birth to a natural child or
 ii. The employee has taken legal custody of an adopted child
 and
c. The employee is a full time employee and
d. The employee has been employed for at least 12 months continuously

The original source of the example.

The official Oracle documentation is here.