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

5
  • 1
    Not entirely related, but many of the answers involve languages that support syntax modification, and thus may be what you're looking for: http://programmers.stackexchange.com/questions/145751/has-whitespace-in-identifiers-ever-been-idiomatic
    – Telastyn
    Apr 29, 2012 at 13:24
  • 2
    Some programming languages are not modeled on either machine code or natural language. Languages such as PROLOG, for example, don't follow either model...
    – Andres F.
    Apr 29, 2012 at 15:09
  • You should also note programming languages that are primarily inspired by math. At least in PL research, these are fairly common. Jun 3, 2012 at 21:12
  • @TikhonJelvis you mean that for a programming language being able to express mathematical structures and concepts is considered more important than being similar to natural languages? Jun 3, 2012 at 21:25
  • Sort of. Particularly, I'm thinking of languages where you represent computation primarily using mathematical ideas. Mostly functional programming languages like Haskell. So it doesn't just express mathematical concepts, it actually uses them for everything like representing state and IO. It's also closer to mathematical notation than a natural language. Jun 3, 2012 at 21:30

2 Answers 2

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.

9
  • 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. Apr 29, 2012 at 13:55
  • also, by extension XML could be considered.
    – alfa64
    Apr 29, 2012 at 18:35
  • 3
    Might consider Forth, which doesn't have much of a grammar. May 22, 2012 at 19:46
  • 1
    AFAIK HTML isn't a programming language.
    – jcora
    May 22, 2012 at 20:19
  • 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!
    – user7519
    May 22, 2012 at 21:56
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.