Froglingo

An Alternative to DBMS, Programming Language, Web Server, and File System

 

 

/*         Case Study: A College Student Registration Application

                        Froglingo Development Association

                                    2/30/2010

 

            File Name: college.frog

            The MS DOS command to inventory this application: frog -b college.frog

            For example in the folder FOLDER having the executable frog.exe:

                        C:\FOLDER\frog -b college.frog

 

            Description: This application allows students to register courses

            on-line. Assume that any student in acollege can register any

            courses offered by the school.

*/

 

/* Choose a password for the entire system (//root).

When this file is batch-loaded by using option "-b", the password is automatically generated. Please remember the root password that will be displayed on the console */

passwd;

 

/* Create a user, acollege.  Please remember the password automatically generated */

addusr acollege;

 

/* log into the account acollege. The password provided below is a fake one.

It is ignored when the system is batch-loading the data by using option "-b"

*/

login acollege "pas";

 

/* Create a user, john.smith under the account acollege */

addusr john.smith;

 

/* Create data under the account acollege*/

create dept CS 100;

create dept math 200;

create dept CS 202;

 

/* If the class selected is valid, then register the user as a student in the class by recording the registration time*/

create if_class_valid true $usr $class = (create $class $usr = timestamp), "You have successfully registered the class ", $class;

 

/* If the class selected is invalid, then give an error message*/

create if_class_valid false $usr $class = "The class you selected doesn't exist ", $class;

 

/* The interface rec_req: receive request for users. Here the paramter $usr

is restricted to be "signature" only, that will give the footprint of the user */

create rec_req $usr:[$usr isa signature] $class = if_class_valid ($class != null) $usr $class;

 

/* only a user under acollege can access the interface rec_req,

   Here only the users under acollege are privileged to access rec_req.

   Not that another boolean clause $usr isa signature is not needed, and

   also logically wrong because $user must be a user account. It always

   return false because $user is not literally "signature", but the account name  */

grtacc rec_req $user:[$user {+ . ];

 

 

/* A sample registration event by acollege john.smith */

login (//acollege john.smith) "kk";

.. rec_req signature (.. dept CS 100);

 

/* or equivalently:

//acollege rec_req signature (//acollege dept CS 100);

*/