Programming Language

From GM-RKB
Jump to navigation Jump to search

A programming language is a machine processable formal language that can be used to create a software program.



References

2015

2013

  • (Wikipedia, 2013) ⇒ http://en.wikipedia.org/wiki/Programming_language#Syntax
    • A programming language's surface form is known as its syntax. Most programming languages are purely textual; they use sequences of text including words, numbers, and punctuation, much like written natural languages. On the other hand, there are some programming languages which are more graphical in nature, using visual relationships between symbols to specify a program.

      The syntax of a language describes the possible combinations of symbols that form a syntactically correct program. The meaning given to a combination of symbols is handled by semantics (either formal or hard-coded in a reference implementation). Since most languages are textual, this article discusses textual syntax.

      Programming language syntax is usually defined using a combination of regular expressions (for lexical structure) and Backus–Naur Form (for grammatical structure). Below is a simple grammar, based on Lisp:

expression ::= atom | list
atom ::= number | symbol
number ::= [+-]?['0'-'9']+
symbol ::= ['A'-'Z''a'-'z'].*
list ::= '(' expression* ')'
    • This grammar specifies the following:
      • an expression is either an atom or a list ;
      • an atom is either a number or a symbol ;
      • a number is an unbroken sequence of one or more decimal digits, optionally preceded by a plus or minus sign;
      • a symbol is a letter followed by zero or more of any characters (excluding whitespace); and
      • a list is a matched pair of parentheses, with zero or more expressions inside it.
    • The following are examples of well-formed token sequences in this grammar: '12345', '()', '(a b c232 (1))'