Wednesday, February 9, 2011

ASSIGNMENT.

1. Scheme. If you come from a “curly braces” background you should learn a functional language. As Eric Raymond says about the very similar Lisp:
LISP is worth learning for a different reason — the profound enlightenment experience you will have when you finally get it. That experience will make you a better programmer for the rest of your days, even if you never actually use LISP itself a lot.
Example: 
(define hello-world
   (lambda ()
         (begin
 (write ‘Hello-World)
            (newline)
 (hello-world))))
sample run: 


Hello-World 




2. Erlang. Another functional language. Concurrency done right. In the multiprocessor future this could be very important indeed


Example: 

start() ->
         case (catch register(ftp_server, 
                              spawn(?MODULE, internal, []))) of
             {'EXIT', _} ->
                 already_started;
             Pid ->
                 ok
         end.

3. Ruby. A conscious attempt to make a programming language that is a joy to use. String handling from Perl, OO from Smalltalk, closures from Lisp/Scheme.

Example
puts" puts work"
puts"with line breaks"

print"print works"
string"with no line breaks"

printf ("\n\nprintf format numbers like %7.2f, and 
strings like %s.".3.14156, "me")

output

puts work
  with line breaks
print works with no line breaks

printf format numbers like 3.14, strings like me.


4.  FASM (Flat Assembler) is a type of computer software, a tool for programming, called an assembler. It supports programming in Intel-Styl assemble languange on the IA-32 and x86-64 computer architectures.

Example: 

format PE
entry main

include 'win32a.inc'

<<variables>>

section '.code' code readable executable
  main:

<<code code code>>

proc One a, b, c, d

        <<code code code >>
        ret
endp

section '.idata' import data readable writeable
  library kernel32, 'kernel32.dll',\
          advapi32, 'advapi32.dll',\
          user32, 'user32.dll',\
          shell32, 'shell32.dll'

  include 'api\kernel32.inc'
  include 'api\advapi32.inc'
  include 'api\user32.inc'
  include 'api\shell32.inc'        



5. MACRO-11 is an assembly language with macro facilities for PDP-11 minicomputers from Digital Equipment Corporation (DEC). It is the successor to PAL-11(Program Assembler Loader), an earlier version of the PDP-11 assembly language without macro facilities.

Example:   
.TITLE  HELLO WORLD
        .MCALL  .TTYOUT,.EXIT
HELLO:: MOV     #MSG,R1 ;STARTING ADDRESS OF STRING
1$:     MOVB    (R1)+,R0 ;FETCH NEXT CHARACTER
        BEQ     DONE    ;IF ZERO, EXIT LOOP
        .TTYOUT         ;OTHERWISE PRINT IT
        BR      1$      ;REPEAT LOOP
DONE:   .EXIT
 
MSG:    .ASCIZ /Hello, world!/
        .END    HELLO

.MACRO HELLO
ERRORS DETECTED:  0
 
.LINK HELLO
 
.R HELLO
Hello, world!
.
Comparison of ruby and scheme
A few programming languages have the concept of atom or symbol to represent a constant of sorts. There are a few differences among the languages I have come across Lisp and Ruby.
 

No comments:

Post a Comment