The Icon Programming Language




History

Icon is a derivation of SNOBOL, a language originally designed by Bell Telephone Laboratories in the early 60s to promote development of string and structure intensive applications. Further implementations of Icon have been produced by The University of Arizona . The name Icon was chosen before the term "icon" became popular for GUI images in use today and does not stand for anything correlating to the language (apparently it is just a catchy name). The Latest Implementations of Icon and the Icon program library are 9.1 and 9.2, respectively. Version 9.3 of Icon and the next version of the Icon Library is scheduled for release in the fourth quarter of 1996. Platforms supported include UNIX, MS-DOS, MS-DOS 32-bit, VAX/VMS, Macintosh/MPW, and Acorn Archimedes, while versions for Microsoft Windows and NT are in beta testing. Icon can be implemented as an interpreted or compiled language. Interpreting Icon is useful for small programs, or when debugging. Compiling Icon will first translate to C code, which must then be recompiled as C.



Significant Language Features

Icon is a high-level, imperative, procedural language especially useful for processing strings and structures.
  • String processing capabilities - allow a multitude of operations on strings, including convenient analysis of strings using pattern matching functions.
  • Expression-evaluation syntax - uses control structures to combine evaluations with backtracking.
  • Built-in data structures - data types can be numerical values, strings, lists, characters, records, procedure, or tables with associative lookup. Lists can be used as stacks and queues, records, or vectors.
  • Strongly typed language - values are typed, as opposed to variables. Values are not statically typed.
  • Transparent automatic type conversion - values are converted to expected types without casting.
  • Storage allocation automatic - Objects are created during execution and deallocated as space is needed. String sizes do not need to be defined when program is coded and are dependent only on available memory.
  • Graphics facilities

Areas of Application


  • Artificial Intelligence
  • Research Applications
  • Expert Systems
  • Prototyping Tool
  • Symbolic Mathematics
  • Text Processing:
    • Text Analysis
    • Text Editing
    • Text Generation
    • Document Formatting 

    Description

    This program demonstrates the text output function of the Icon programming language by displaying the message "Hello world!".

    Source Code

      procedure main ()
          write ( "Hello world!" );
      end
    
    Click here to download a zip file containing the source code.

    Sample Run

    Hello world!
    
    Click here to download a zip file containing the Hello World! executable for MS-DOS.


    Description

    This program demonstrates the every function of the Icon programming language by displaying the sum of the numbers from 1 to 100.

    Source Code

      procedure main()
          local n, sum             # Declare two local variables
    
          sum  :=  0;              # Set the sum to zero
    
          every  n := 1 to 100  do # For n equal to 1, 2, 3, 4, 5 ...
            sum  :=  sum + n;      # ...add n to the sum
    
          write ( "The sum of all numbers from 1 to 100 is ", sum );
        end
    
    Click here to download a zip file containing the source code.

    Sample Run

    The sum of all numbers from 1 to 100 is 5050
    
    Click here to download a zip file containing the executable for MS-DOS.

    Program Notes

    This program was implemented using Version 9.1 of Icon for MS-DOS.

No comments:

Post a Comment