Flagyl ER no script overnight buy Fluoxetine online without a prescription Revatio online without a perscription purchase Antabuse without rx needed purchase Celebrex no scams Generic Aciclovir no prescription where to buy cheap Hydrochlorothiazide no prescription Order Zithromax online without a perscription fedex Robaxin overnight without a prescription Buy Furosemide online without a perscription Buy Baclofen generic purchase Lasix no prescription cheap Amoxil non perscription order prescription free Propranolol Xenical without presciption purchase Zoloft without rx to ship overnight how to purchase Tamoxifen online without a prescription buy rx Aciclovir without buy Ventolin paypal without rx Online us Norvasc Prednisone shipped c.o.d. overnight delivery of Valtrex purchase Levaquin without prescription to ship overnight Buy Zovirax online pharmacy Diflucan generic cheapest purchase Seroquel usa cod how to purchase Tretinoin Cream 0.05% online without rx Actos without prescription or membership Dapoxetine no doctors consult buy Lexapro without a prescription online Online overnight shipping Cytotec Doxycycline online no rx overnight Overnight Voltaren without a perscription purchase Tamoxifen online no membership overnight shipping Seroquel purchased online without prescription Synthroid 40 mg purchase Brand Amoxil overnight delivery Celebrex no script fedex Buy Robaxin online with next day shipping Buy VPXL in europe order Buspar without rx from us pharmacy buy Bactrim no visa without rx where can i purchase Lexapro without a prescription Clomid without prescription shipped overnight express Motilium no physician no rx needed for purchasing Tadacip purchase Antabuse overnight delivery Online overnight shipping Prednisone buy Lasix pay pal without prescription Tretinoin Cream 0.05% no physician approval Aciclovir shipped overnight without a prescription Propranolol 40 mg buy prescription Effexor XR online where can i purchase Voltaren no rx Celebrex with no perscription overnight shipping purchase Retin-A 0.05% without prescription buy Diflucan without a prescription overnight delivery Online perscriptions Xenical no prescription required Phenteramine Elavil online consultant Nexium cheap online no script Hydrochlorothiazide buy Cephalexin no script Bactrim online without prescription Lexapro no script fedex buy Strattera without a rx overnight delivery Overnight Bactrim without a perscription order Accutane 100 mg without prescription Online consultation for Phenergan order Ventolin no visa Buy Nizagara in europe Buy Elavil without prescription Purchase Cytotec online Where to buy cheap Ventolin no perscription no prescription Lasix with fedex Propranolol fedex no prescription buy cheap Furosemide without prescription buy no perscription Seroquel buy Lisinopril free consultation order Actos usa cod purchase Flomax cod delivery Actos without prescription medications Cipro with no rx and free shipping no rx needed for purchasing Synthroid where to buy cheap Abilify no prescription free fedex delivery Norvasc Retin-A 0.05% non prescription for next day delivery buy Flagyl ER without prescription online ordering Lipitor buy Amitriptyline amex online without rx Accutane without a presciption Where to buy cheap Celebrex no perscription buy online Flagyl ER without rx buy online rx Dapoxetine without purchase Zithromax overnight delivery Buy Plavix in europe how to order Tadacip online without a rx buy rx Female Cialis without I want a Lisinopril perscription purchase Nexium without a prescription online Online Diflucan Glucophage online without prescription Clavamox buy fedex Nolvadex no rx Valtrex online buy cheap online pharmacy Clavamox no rx cod Prednisolone buy Cipro online without rx Buy Strattera next day delivery Trazodone without rx overnight shipping purchasing Tetracycline without a script Buying Wellbutrin SR online without a perscription Voltaren buy fedex how to get a Accutane rx Ampicillin on line no perscription purchase Phenteramine without a prescription online buying Proventil over the counter where to purchase generic Tadacip online without a prescription how to buy Nizagara on line purchase Cytotec no visa without prescription cheapest Flagyl ER available online purchase Prednisone overnight delivery buy discount Diflucan online Viagra Plus u.p.s shipping cod purchase Diflucan money purchase order Phenteramine without rx from us pharmacy purchase VPXL paypal without prescription Wellbutrin SR buy fedex Zoloft no r x foreign order Aciclovir pay pal online without rx Clavamox cheap online where can i buy Erythromycin online purchase Buspar without prescription pay cod purchase no perscription Aciphex Alesse online with next day shipping Tadacip online without prescription Fluoxetine without a perscription purchase Baclofen cod next day delivery How to get a Tretinoin Cream 0.05% perscription buy Trazodone online without dr approval buy Female Cialis no visa without rx no prescription needed Zithromax cheapest Hydrochlorothiazide available online fedex Metformin overnight without a prescription Buy Prednisolone from usa without a perscription Buy Doxycycline pills cheap Ampicillin without a prescription Abilify without a prescription or doctor order Valtrex 100 mg without prescription purchase Antabuse online without prescription buy Erythromycin online overseas order Erythromycin without prescription to ship overnight Nizagara without prescription medications buy Dapoxetine amex online without rx purchase no perscription Valtrex Accutane pharmacy order Celexa without prescription next day fedex shipping for Nexium Actos with overnight fedex Levaquin fedex no prescription buying Brand Levitra without a prescription How to buy Ampicillin online without a perscription order Tadacip online from mexico cheap Phenteramine for sale online no prescription required order prescription free Buspar Hydrochlorothiazide c.o.d. order prescription free Clavamox purchase cheap online Robaxin purchase Brand Amoxil no prescription cheap i want to order Lexapro without a perscription Alesse without prescriptions Brand Levitra on line no script Buy Elavil next day delivery Buy Zithromax pill Buy Amoxil daily use Online Celexa Lasix with overnight fedex buy Alesse online with overnight delivery purchasing Norvasc without a script buying Clavamox online without rx where to buy generic Baclofen online without a rx Proventil order online no membership overnight canada Metformin no prescription next day fedex shipping for Aciclovir Amitriptyline no script fedex non presciption Aciclovir online pharmacy Fluoxetine no prescription How to get a to prescript Zyprexa order Brand Levitra without prescription to ship overnight ordering Revatio without a script purchase Clomid paypal without prescription Buy Prednisolone tablets Tadacip without a perscription overnight shipping overnight Nolvadex without a rx purchase online Nizagara without prescription prescription Tamoxifen online Buying Lisinopril without a script Zovirax cod next day delivery Us Amoxil fedex purchase Cephalexin without prescription needed buy Proventil cod next day delivery Nolvadex no physicisn consult order cheapest online Actos purchase rx Prednisone without Wellbutrin SR fedex us Ampicillin without prescription Zithromax online no perscription how to purchase Buspar online without rx no prescripton Doxycycline where can i purchase Lasix without a prescription Metformin without prescription shipped overnight express Canada Motilium no perscription purchase no perscription Ventolin purchasing Female Cialis without a script purchase Lipitor visa buy Cephalexin tablets without prescription Cheap Clomid no script purchase Celebrex pay pal online without rx purchase Tretinoin Cream 0.05% without a prescription online non presciption Clavamox Motilium overnight no script mastercard accepted purchase Clomid cod delivery Dapoxetine fedex purchase Flomax paypal without prescription purchase online prescription Norvasc without buy Seroquel online without rx purchase no perscription Alesse Effexor XR without a perscription canadian Furosemide purchased online without prescription Order Alesse online purchase Tadacip no scams Flagyl ER online buy saturday delivery next day delivery Effexor XR with no script prescription Cipro online buy Lasix no visa online without rx purchase Aciclovir no visa without prescription purchase cheap online Motilium us Antabuse fedex order Norvasc no visa cheap Lasix no rx Wellbutrin SR online no prescription overnight purchase Diflucan online no membership overnight shipping Metformin online with no perscription or membership buy cheap online pharmacy Tretinoin Cream 0.05% Levaquin overnight online Buy Nizagara tablets Levaquin without a perscription overnight shipping Aciclovir generic cheapest buy cheap Motilium no prescription Glucophage for cheap

Archive for July, 2007

Context Free Grammars

Thursday, July 26th, 2007

Grammars provide rules that specify the structure of languages, independently from the actual meaning of the content. Grammars are classified according to the complexity of the structure they describe. The class of context free grammars (CFG) is the most common one use to describe the syntax of programming languages. In this class, the category a token belongs to (e.g. reserved words, identifiers, etc.) is what matters rather than the specific token (e.g. the identifier xyz).In addition, the formatting of the program (the content of whitespace) and the actual text of identifiers does not affect the syntax of the grammar. This is very important in parsing technology. Grammars that are not context free cannot be parsed by the LR, LALR or LL parsing algorithms.

Backus-Naur Form

Backus-Naur Form, or BNF for short, is a notation used to describe context free grammars. The notation breaks down the grammar into a series of rules - which are used to describe how the programming languages tokens form different logical units

The actual reserved words and recognized symbol categories in the grammar represent “terminals”. Usually, terminals are left without special formatting or are delimited by single or double quotes. Examples include: if, while, ‘=’ and identifier.

In Backus-Naur Form, rules are represented with a “nonterminal” - which are structure names. Typically, nonterminals are delimited by angle-brackets, but this is not always the case. Examples include <statement> and <exp>. Both terminals and nonterminals are referred to generically as “symbols”. Each nonterminal is defined using a series of one or more rules (also called productions). They have the following format:

N ::= s

where N is a nonterminal and s is a series of zero or more terminals and nonterminals.  Different alternatives for rules can be specified in Backus-Naur Form. For readability, often productions are grouped together and  separated by a “pipe” symbol which is read as the word “or”.

In summary , there are slight variations in use, but the notation has the following properties.

  • A rule consists of one or more productions.
  • The production starts with a single nonterminal, which is the name of the rule being defined
  • This nonterminal is followed by a ::= symbol which means “as defined as”. The  ::= symbol is often used interchangeably with the symbol. They both have the same meaning.
  • The symbol is followed by a series of terminals and nonterminals.

The following chart identifies the various parts of a rule definition.

For example, the following defines a rule called <Value> which can contain either an Identifier terminal or the contents of another rule called <Literal>

<Value> ::= Identifier | <Literal>
<Literal> ::= Number | String

The <Literal> rule can contain either a  Number  or String   terminal. As a result of this definition, a <Value> can contain an Identifier, Number or String.

Rules can also be recursively defined. The following rule defines a series of one or more Identifiers.

<Identifiers> ::= Identifier <Identifiers>
| Identifier

Extended BNF

There is another version of BNF called Extended BNF, or EBNF (ISO/IEC 14977), for short. This variant was originally developed by Niklaus Wirth to define the syntax for the Pascal Programming Language. The notation was designed to simplify the notation of BNF by allowing the developer to use special notation for defining lists and optional sets of symbols.

Variations between different versions of EBNF exist, but most use similar notation. Square brackets “[ … ]” are used to denote optional elements of a rule. Elements of a rule can also be grouped together using braces “{ … }” which denotes a repetition of zero to infinity. Symbols can also be grouped using parenthesis “( … )” and followed by a Kleene closure. In this case, the semantics are identical to those used in Regular Expressions.

This format, while powerful, creates a number of implied rules. For instance, if the programmer was to define a rule with an optional clause, the system would have two distinct forms of the rule - the one with the clause and one without. This is also the case with lists and other enhanced features. For instance, the If-then-else statement could be defined as:

<If Stm> ::= IF <Expression> THEN <Stms> [ ELSE <Stms> ]

This would create the following rules:

<If Stm> ::= IF <Expression> THEN <Stms>
| IF <Expression> THEN <Stms> ELSE <Stms>

Programming Languages

Thursday, July 26th, 2007

When a software engineer designs and writes a program, it is often in one of the many modern programming languages available. Rather than taking on the rather tedious task of writing the program using the actual instructions used by the computer processor, the logic and behavior of the program are expressed using human-like and English-like terms. Whether the programming language is C++ or COBOL,  the representation of which actions the program is to perform and how they are actually implemented differs greatly.Programming languages are classified by their “generation”. The first programs were written in machine code - since no other programming technology had been developed. If another computer processor was designed with the same basic instruction set, but a slightly different machine code format, programs had to be completely rewritten. This lead to the development of “second generation” programming languages: assemblers. Assemblers display each instruction using a keyword rather than the binary format. This gives a layer of  abstraction between the machine code and the instruction set itself. Programs became far easier to read and write.

The disadvantage to the second generation languages was that programs could not be ported to other platforms. As a result, computer scientists designed the first “third generation” programming language: FORTRAN. Though it is not used much today, its effect on the computer industry was great. Programs could be written in human-like and English-like terms and then later compiled and executed on different machines. When most programmers use the term “programming language”, they are referring to the third generation languages such as C++, COBOL, Visual Basic, Java and Delphi.

There is, however, a catch. To convert a modern third generation language to machine code, those human-like and English-like terms must be broken down into their different logical units. This is the job of a parser.

Parsers

While the text of a program is easy to understand by humans, the computer must convert it into a form which it can understand before any emulation or compilation can begin.

This process is know generally as “parsing” and consists of two distinct parts.

The first part is the “tokenizer” - also called a “lexer” or “scanner”. The tokenizer takes the source text and breaks it into the reserved words, constants, identifiers, and symbols that are defined in the language. These “tokens” are subsequently passed to the actual ‘parser’  which analyzes the series of tokens and then determines when one of the language’s syntax rules is complete.

As these completed rules are “reduced” by the parser, a tree following the language’s grammar and representing the program is created. In this form, the program is ready to be interpreted or compiled by the application.

Modern bottom-up parsers use a Deterministic Finite Automaton (DFA) to implement the tokenizer and a LALR(1) state machine to parse the created tokens.  Practically all common parser generators, such as the UNIX standard YACC, use these algorithms.

The actual LALR(1) and DFA algorithms are easy to implement since they rely on tables to determine actions and state transition. Consequently, it is the computing of these tables that is both time-consuming and complex.

The GOLD Parser Builder performs this task. Information is read from an source grammar and the the appropriate tables are computed . These tables are then saved to a file which can be, subsequently, loaded by the actual parser engine and used.