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
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.