*** empty log message ***
[bpt/emacs.git] / lisp / progmodes / ebnf-otz.el
index 0969f87..381fd43 100644 (file)
@@ -1,19 +1,19 @@
-;;; ebnf-otz.el --- syntatic chart OpTimiZer
+;;; ebnf-otz.el --- syntactic chart OpTimiZer
 
-;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;;   Free Software Foundation, Inc.
 
-;; Author:     Vinicius Jose Latorre <vinicius@cpqd.com.br>
-;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
-;; Keywords:   wp, ebnf, PostScript
-;; Time-stamp: <2001-07-15 01:03:33 pavel>
-;; Version:    1.0
+;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
+;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
+;; Keywords: wp, ebnf, PostScript
+;; Version: 1.0
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,9 +21,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;; See ebnf2ps.el for documentation.
 ;;
 ;;
+;; Optimizations
+;; -------------
+;;
+;;
+;; *To be implemented*:
+;;    left recursion:
+;;    A = B | A C B | A C D.   ==>   A = B {C (B | D)}*.
+;;
+;;    right recursion:
+;;    A = B | C A.             ==>   A = {C}* B.
+;;    A = B | D | C A | E A.   ==>   A = { C | E }* ( B | D ).
+;;
+;;    optional:
+;;    A = B | C B.             ==>   A = [C] B.
+;;    A = B | B C.             ==>   A = B [C].
+;;    A = D | B D | B C D.     ==>   A = [B [C]] D.
+;;
+;;
+;; *Already implemented*:
+;;    left recursion:
+;;    A = B | A C.             ==>   A = B {C}*.
+;;    A = B | A B.             ==>   A = {B}+.
+;;    A =   | A B.             ==>   A = {B}*.
+;;    A = B | A C B.           ==>   A = {B || C}+.
+;;    A = B | D | A C | A E.   ==>   A = ( B | D ) { C | E }*.
+;;
+;;    optional:
+;;    A = B | .                ==>   A = [B].
+;;    A =   | B .              ==>   A = [B].
+;;
+;;    factorization:
+;;    A = B C | B D.           ==>   A = B (C | D).
+;;    A = C B | D B.           ==>   A = (C | D) B.
+;;    A = B C E | B D E.       ==>   A = B (C | D) E.
+;;
+;;    none:
+;;    A = B | C | .            ==>   A = B | C | .
+;;    A = B | C A D.           ==>   A = B | C A D.
+;;
+;;
 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;; Code:
 ;;    A = B | .                ==>   A = [B].
 ;;    A =   | B .              ==>   A = [B].
 
-;;    factoration:
+;;    factorization:
 ;;    A = B C | B D.           ==>   A = B (C | D).
 ;;    A = C B | D B.           ==>   A = (C | D) B.
 ;;    A = B C E | B D E.       ==>   A = B (C | D) E.
 ;;    A = B | C A D.           ==>   A = B | C A D.
 
 (defun ebnf-optimize (syntax-list)
-  "Syntatic chart optimizer."
+  "Syntactic chart optimizer."
   (if (not ebnf-optimize)
       syntax-list
     (let ((ebnf-total (length syntax-list))
 ;; 6.  A = B | .                ==>   A = [B].
 ;; 7.  A =   | B .              ==>   A = [B].
 
-;; factoration:
+;; factorization:
 ;; 8.  A = B C | B D.           ==>   A = B (C | D).
 ;; 9.  A = C B | D B.           ==>   A = (C | D) B.
 ;; 10. A = B C E | B D E.       ==>   A = B (C | D) E.
 
 (defun ebnf-optimize1 (prod)
-  (ebnf-message-info "Optimizing syntatic chart")
+  (ebnf-message-info "Optimizing syntactic chart")
   (let ((production (ebnf-node-production prod)))
     (and (eq (ebnf-node-kind production) 'ebnf-generate-alternative)
         (let* ((hlist (ebnf-split-header-prefix
 (provide 'ebnf-otz)
 
 
+;; arch-tag: 7ef2249d-9e8b-4bc1-999f-95d784690636
 ;;; ebnf-otz.el ends here