1 / 17

Programming Languages

Programming Languages. From FORTRAN to WHYP. A Brief History of Programming Languages. http://www.byte.com/art/9509/sec7/art19.htm. http://merd.net/pixel/language-study/diagram.html. How would you have a computer evaluate this expression?. X = A*B + (C – D)/(E + F).

herve
Download Presentation

Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Languages From FORTRAN to WHYP

  2. A Brief History of Programming Languages http://www.byte.com/art/9509/sec7/art19.htm http://merd.net/pixel/language-study/diagram.html

  3. How would you have a computer evaluate this expression? X = A*B + (C – D)/(E + F) Reverse Polish Notation (RPN) Postfix AB*CD-EF+/+

  4. Forth http://www.ultratechnology.com/dindex.htm

  5. WHYP • Pronounced “whip” • “Words to Help You Program” • Subroutine-threaded Forth for Embedded Systems • 68HC11 (16-bit) • 68332 (32-bit) • 68HC12 (16-bit)

  6. WHYP is developed from scratch in the new book:Design of Embedded Systems Using 68HC12/11 MicrocontrollersbyRichard E. HaskellPrentice Hall, 2000

  7. FORTH is a programming language that --- • was invented by Charles Moore in the early 70’s • is extensible • keeps all definitions in a dictionary • is extremely compact • is recursive • can be programmed in RAM, PROM, or ROM • is structured • uses a stack and postfix notation

  8. Chuck Moore reading Haskell’s WHYP book

  9. WHYP Colon Definitions : squared ( n -- n**2) DUP * ; : cubed ( n -- n**3) DUP \ n n squared \ n n**2 * ; \ n**3

  10. Branching and Looping in WHYP • IF…ELSE…THEN • FOR…NEXT • BEGIN…AGAIN • BEGIN…UNTIL • BEGIN…WHILE…REPEAT

  11. IF…ELSE…THEN <cond> IF <true statements> ELSE <false statements> THEN <cond> is either TRUE (-1) or FALSE (0)

  12. WHYP Conditional Words < ( n1 n2 -- f ) (“less-than”) > ( n1 n2 -- f ) (“greater-than”) = ( n1 n2 -- f ) (“equals”) <> ( n1 n2 -- f ) (“not-equals”) <= ( n1 n2 -- f ) (“less-than or equal”) >= ( n1 n2 -- f ) (“greater-than or equal”) 0< ( n -- f) (“zero-less”) 0> ( n -- f) (“zero-greater”) 0= ( n -- f) (“zero-equal”) U< ( u1 u2 -- f ) (“U-less-than”) U> ( u1 u2 -- f ) (“U-greater-than”) U<= ( u1 u2 -- f ) (“U-less-than or equal”) U>= ( u1 u2 -- f ) (“U-greater-than or equal”)

  13. FOR…NEXT Loop n FOR <WHYP statements> NEXT >R drjne <WHYP statements> Decrement top of return stack and branch back to <WHYP statements> if not equal to zero. Therefore, <WHYP statements> are executed n times.

  14. BEGIN…AGAIN BEGIN <WHYP statements> AGAIN

  15. BEGIN…UNTIL BEGIN <WHYP statements> <flag> UNTIL <flag> is either TRUE or FALSE usually from some WHYP conditional word

  16. BEGIN…WHILE…REPEAT BEGIN <words> <flag> WHILE <words> REPEAT

More Related