Source

semantic / scheme.bnf

# Scheme BNF language specification
#
# Copyright (C) 2001 Eric M. Ludlam
#
# Author: Eric M. Ludlam <zappo@gnu.org>
# X-RCS: $Id$
#
# This 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.
#
# This software 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.

%start         scheme
%outputfile    semantic-scm.el
%parsetable    semantic-toplevel-scheme-bovine-table
%keywordtable  semantic-scheme-keyword-table
%languagemode  scheme-mode
%setupfunction semantic-default-scheme-setup

%(setq semantic-symbol->name-assoc-list '( (variable . "Variables")
					   ;;(type     . "Types")
					   (function . "Functions")
					   (include  . "Loads")
					   (package  . "DefinModule"))
       semantic-number-expression nil
       imenu-create-index-function 'semantic-create-imenu-index
       semantic-dependency-include-path semantic-default-scheme-path
       imenu-create-index-function 'semantic-create-imenu-index
       document-comment-start ";;"
       document-comment-line-prefix ";;"
       document-comment-end "\n"
       )%

%token DEFINE "define"
%put DEFINE summary "Function: (define symbol expression)"
%token DEFINE-MODULE "define-module"
%put DEFINE-MODULE summary "Function: (define-module (name arg1 ...)) "
%token LOAD "load"
%put LOAD summary "Function: (load \"filename\")"

scheme : semantic-list
	 (EXPAND $1 scheme-list 4)
       ;

scheme-list : open-paren "(" scheme-in-list
	      ( ,$2 )
	    ;

scheme-in-list: DEFINE symbol expression
		( $2 variable nil $3 nil )
	      | DEFINE name-args opt-doc
		( (car ,$2) function (cdr ,$2) nil ,$3 )
	      | DEFINE-MODULE name-args
		( (nth (length $2) $2 ) provide nil)
	      | LOAD string
		( (file-name-nondirectory (read $2)) require (read $2) )
	      | symbol
		( $1 code )
	      ;

name-args: semantic-list
	   (EXPAND $1 name-arg-expand)
	 ;

name-arg-expand : open-paren name-arg-expand
		  ( ,$2 )
		| symbol name-arg-expand
		  ( ,(cons $1 ,$2) )
		| EMPTY
		  (  )
		;

opt-doc : string
	| EMPTY
	;

expression : symbol
	   | semantic-list
	   | string
	   ;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.