Programming Languages - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Programming Languages

Description:

Reverse Polish Notation (RPN) Postfix. AB*CD-EF / Forth ... keeps all definitions in a dictionary. is extremely compact. is recursive ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 18
Provided by: hask
Category:

less

Transcript and Presenter's Notes

Title: Programming Languages


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 AB (C D)/(E F)
Reverse Polish Notation (RPN) Postfix ABCD-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
bookDesign 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 70s
  • 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 Haskells WHYP book
9
WHYP Colon Definitions
squared ( n -- n2) DUP cubed ( n
-- n3) DUP \ n n squared \ n
n2 \ n3
10
Branching and Looping in WHYP
  • IFELSETHEN
  • FORNEXT
  • BEGINAGAIN
  • BEGINUNTIL
  • BEGINWHILEREPEAT

11
IFELSETHEN
ltcondgt IF lttrue statementsgt ELSE ltfalse
statementsgt THEN
ltcondgt is either TRUE (-1) or FALSE (0)
12
WHYP Conditional Words
lt ( n1 n2 -- f ) (less-than) gt ( n1 n2 -- f
) (greater-than) ( n1 n2 -- f
) (equals) ltgt ( n1 n2 -- f ) (not-equals) lt (
n1 n2 -- f ) (less-than or equal) gt ( n1 n2
-- f ) (greater-than or equal) 0lt ( n --
f) (zero-less) 0gt ( n -- f) (zero-greater) 0
( n -- f) (zero-equal) Ult ( u1 u2 -- f
) (U-less-than) Ugt ( u1 u2 -- f
) (U-greater-than) Ult ( u1 u2 -- f
) (U-less-than or equal) Ugt ( u1 u2 -- f
) (U-greater-than or equal)
13
(No Transcript)
14
FORNEXT Loop
n FOR ltWHYP statementsgt NEXT
gtR
drjne ltWHYP statementsgt
Decrement top of return stack and branch back to
ltWHYP statementsgt if not equal to
zero. Therefore, ltWHYP statementsgt are executed n
times.
15
BEGINAGAIN
BEGIN ltWHYP statementsgt AGAIN
16
BEGINUNTIL
BEGIN ltWHYP statementsgt ltflaggt UNTIL
ltflaggt is either TRUE or FALSE usually from some
WHYP conditional word
17
BEGINWHILEREPEAT
BEGIN ltwordsgt ltflaggt WHILE ltwordsgt REPEAT
Write a Comment
User Comments (0)
About PowerShow.com