2023 2024 Student Forum > Management Forum > Main Forum

 
  #2  
25th November 2015, 05:41 PM
Super Moderator
 
Join Date: Apr 2013
Re: BCPL and B Languages

Feel free buddy I will help you here to get the information about the BCPL (Basic Combined Programming Language) and b Language so that you can have idea about it

(Basic Combined Programming Language)
Originally intended for writing compilers for other languages, BCPL is no longer in common use

BCPL was the first brace programming language

BCPL was a response to difficulties with its predecessor Combined Programming Language (CPL)

It was designed so that small and simple compilers could be written for it

B Language
B is a programming language was setup in 1969 and developed at Bell Labs circa

B was derived from BCPL, and its name may be a contraction of BCPL

B was designed for recursive, non-numeric, machine independent applications,

Example of the B Language
GET "LIBHDR"

LET START() = VALOF $(
FOR I = 1 TO 5 DO
WRITEF("%N! = %I4*N", I, FACT(I))
RESULTIS 0
$)

AND FACT(N) = N = 0 -> 1, N * FACT(N - 1)

Count solutions to the N queens problem:

GET "LIBHDR"

GLOBAL $(
COUNT: 200
ALL: 201
$)

LET TRY(LD, ROW, RD) BE
TEST ROW = ALL THEN
COUNT := COUNT + 1
ELSE $(
LET POSS = ALL & ~(LD | ROW | RD)
UNTIL POSS = 0 DO $(
LET P = POSS & -POSS
POSS := POSS - P
TRY(LD + P << 1, ROW + P, RD + P >> 1)
$)
$)

LET START() = VALOF $(
ALL := 1
FOR I = 1 TO 12 DO $(
COUNT := 0
TRY(0, 0, 0)
WRITEF("%I2-QUEENS PROBLEM HAS %I5 SOLUTIONS*N", I, COUNT)
ALL := 2 * ALL + 1
$)
RESULTIS 0
$)


Quick Reply
Your Username: Click here to log in

Message:
Options

Thread Tools Search this Thread



All times are GMT +5. The time now is 04:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
SEO by vBSEO 3.6.0 PL2

1 2 3 4