Concept

Comparison of programming languages (syntax)

Résumé
This comparison of programming languages compares the features of language syntax (format) for over 50 computer programming languages. Programming language expressions can be broadly classified into four syntax structures: prefix notation Lisp (* (+ 2 3) (expt 4 5)) infix notation Fortran (2 + 3) * (4 ** 5) suffix, postfix, or Reverse Polish notation Forth 2 3 + 4 5 ** * math-like notation TUTOR (2 + 3)(45) $$ note implicit multiply operator When a programming languages has statements, they typically have conventions for: statement separators; statement terminators; and line continuation A statement separator demarcates the boundary between two separate statements. A statement terminator defines the end of an individual statement. Languages that interpret the end of line to be the end of a statement are called "line-oriented" languages. "Line continuation" is a convention in line-oriented languages where the newline character could potentially be misinterpreted as a statement terminator. In such languages, it allows a single statement to span more than just one line. Line continuation is generally done as part of lexical analysis: a newline normally results in a token being added to the token stream, unless line continuation is detected. Whitespace – Languages that do not need continuations Ada – Lines terminate with semicolon C# – Lines terminate with semicolon JavaScript – Lines terminate with semicolon (which may be inferred) Lua OCaml Ampersand as last character of line Fortran 90, Fortran 95, Fortran 2003, Fortran 2008 Backslash as last character of line bash and other Unix shells C and C++ preprocessor Mathematica and Wolfram Language Python Ruby JavaScript – only within single- or double-quoted strings Backtick as last character of line PowerShell Hyphen as last character of line SQL*Plus Underscore as last character of line AutoIt Cobra Visual Basic Xojo Ellipsis (as three periods–not one special character) MATLAB: The ellipsis token need not be the last characters on the line, but any following it will be ignored.
À propos de ce résultat
Cette page est générée automatiquement et peut contenir des informations qui ne sont pas correctes, complètes, à jour ou pertinentes par rapport à votre recherche. Il en va de même pour toutes les autres pages de ce site. Veillez à vérifier les informations auprès des sources officielles de l'EPFL.