]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/ebnf-otz.el
(compilation-start): Pass nil as startfile to comint-exec.
[gnu-emacs] / lisp / progmodes / ebnf-otz.el
index 5af9ef6925c92ffea5de2bdaa5d039f1effe387a..c4f9fdcd8c148f646304b002cb1baa2120aa938f 100644 (file)
@@ -1,29 +1,29 @@
-;;; ebnf-otz --- Syntatic chart OpTimiZer
+;;; ebnf-otz.el --- syntactic chart OpTimiZer
 
-;; Copyright (C) 1999 Vinicius Jose Latorre
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;;   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: <99/11/20 18:03:10 vinicius>
-;; 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 *NOT* (yet?) part of GNU Emacs.
+;; This file is part of GNU Emacs.
 
-;; This program 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)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
-;; This program is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; 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:
+;;; Code:
 
 
 (require 'ebnf2ps)
 ;;    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