Initial layout of opossum package.
[cl-opossum.git] / pegutils.lisp
blob80f2cc6a15ed0c4ebd6c4428c848b87803b6525a
1 ;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; -*-
2 ;;;
3 ;;; pegutils.lisp --- Utility functions for implementing PEG parsers
5 ;; Copyright (C) 2008 Utz-Uwe Haus <lisp@uuhaus.de>
6 ;; $Id:$
7 ;; This code is free software; you can redistribute it and/or modify
8 ;; it under the terms of the version 3 of the GNU General
9 ;; Public License as published by the Free Software Foundation, as
10 ;; clarified by the prequel found in LICENSE.Lisp-GPL-Preface.
12 ;; This code is distributed in the hope that it will be useful, but
13 ;; without any warranty; without even the implied warranty of
14 ;; merchantability or fitness for a particular purpose. See the GNU
15 ;; Lesser General Public License for more details.
17 ;; Version 3 of the GNU General Public License is in the file
18 ;; LICENSE.GPL that was distributed with this file. If it is not
19 ;; present, you can access it from
20 ;; http://www.gnu.org/copyleft/gpl.txt (until superseded by a
21 ;; newer version) or write to the Free Software Foundation, Inc., 59
22 ;; Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 ;; Commentary:
26 ;; Some code here is inspired by the metapeg library of John Leuner
28 ;;; Code:
32 (in-package #:opossum)
34 (defclass parse-context ()
35 ((destpkg :accessor get-destpkg :initarg :destpkg)
36 (grammar :accessor get-grammar :initarg :grammar))
37 (:documentation "Parser context"))
40 (defvar *opossum-parser* nil
41 "Special variable bound to the parser context at parse time.")
43 (defun make-name (string)
44 (intern (concatenate 'string "parse_" string)
45 (get-destpkg *opossum-parser*)))