background preloader

PARSING

Facebook Twitter

Martin Geisler Online » Regular Expressions. This is an introduction to regular expressions for those of you that have heard the phrase “just use a regular expression on that string to extract the data…” but doesn’t understand the thing about a “regular expression”. I’ll write RE instead of “regular expression” from now on to save me some typing. The phrase given above hints that one should use a RE on a text string and that it can be used to extract data from such a string. This is what a RE does: it matches something. A RE is a short way of representing a potentially very complex pattern that is to be matched against a string of characters. The simplest RE is one that just matches itself. You can combine two REs by concatenating them (writing them after each other). So far you haven’t seen anything that couldn’t be done just as easy without the use of REs.

Regular Expressions - a Simple User Guide. A Regular Expression is the term used to describe a codified method of searching invented, or defined, by the American mathematician Stephen Kleene.

Regular Expressions - a Simple User Guide

The syntax (language format) described on this page is compliant with extended regular expressions (EREs) defined in IEEE POSIX 1003.2 (Section 2.8). EREs are now commonly supported by Apache, PERL, PHP4, Javascript 1.3+, MS Visual Studio, most visual editors, vi, emac, the GNU family of tools (including grep, awk and sed) as well as many others. Extended Regular Expressions (EREs) will support Basic Regular Expressions (BREs are essentially a subset of EREs). Most applications, utilities and laguages that implement RE's, especially PERL, extend the ERE capabilities and what are typically called PERL Compatible Regular Expressions (PCREs) have, largely, become a de facto standard. Lex and YACC primer/HOWTO. PowerDNS BV (bert hubert <bert@powerdns.com>) v0.8 $Date: 2004/09/20 07:14:23 $ This document tries to help you get started using Lex and YACC 1.

Lex and YACC primer/HOWTO

Introduction Welcome, gentle reader. If you have been programming for any length of time in a Unix environment, you will have encountered the mystical programs Lex & YACC, or as they are known to GNU/Linux users worldwide, Flex & Bison, where Flex is a Lex implementation by Vern Paxson and Bison the GNU version of YACC. These programs are massively useful, but as with your C compiler, their manpage does not explain the language they understand, nor how to use them. 1.1 What this document is NOT There are several great books which deal with Lex & YACC. The documentation that comes with Flex and BISON is also excellent, but no tutorial. I am by no means a YACC/Lex expert. In no way expect the HOWTO to show proper YACC and Lex style. 1.2 Downloading stuff Please note that you can download all the examples shown, which are in machine readable form. Lex & Yacc. <p class="center">Please enable javascript to best experience this site.

Lex & Yacc

</p> This document explains how to construct a compiler using lex and yacc. Lex and yacc are tools used to generate lexical analyzers and parsers. I assume you can program in C and understand data structures such as linked-lists and trees. The Overview describes the basic building blocks of a compiler and explains the interaction between lex and yacc. Permission to reproduce portions of this document is given provided the web site listed below is referenced. Let's Build a Compiler. BNF and EBNF: What are they and how do they work? By: Lars Marius Garshol Contents Introduction What is this?

BNF and EBNF: What are they and how do they work?

This is a short article that attempts to explain what BNF is, based on message <wkwwagbizn.fsf@ifi.uio.no> posted to comp.text.sgml on 16.Jun.98. Because of this it is a little rough, so if it leaves you with any unanswered questions, email me and I'll try to explain as best I can. It has been filled out substantially since then and has grown quite large. What is BNF? Backus-Naur notation (more commonly known as BNF or Backus-Naur Form) is a formal mathematical way to describe a language, which was developed by John Backus (and possibly Peter Naur as well) to describe the syntax of the Algol 60 programming language.

(Legend has it that it was primarily developed by John Backus (based on earlier work by the mathematician Emil Post), but adopted and slightly improved by Peter Naur for Algol 60, which made it well-known. Programs that do this are commonly called "compiler compilers". How it works The principles A real example ? Common uses.