/[svn]/linuxsampler/trunk/scripts/generate_instrument_script_parser.sh
ViewVC logotype

Contents of /linuxsampler/trunk/scripts/generate_instrument_script_parser.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2888 - (show annotations) (download) (as text)
Sun Apr 24 18:16:10 2016 UTC (8 years ago) by schoenebeck
File MIME type: application/x-sh
File size: 1285 byte(s)
* Instrument Scripts: Fixed line numbers on parser error/warning messages.
* Instrument Scripts: Added output of precise column on parser
  error/warning messages.
* Shut up some irrelevant errors of parser generating shell scripts.
* Bumped version (2.0.0.svn6).

1 #!/bin/sh
2 #
3 # Generates the instrument script parser's C++ source files
4 # (parser.h, parser.cpp and scanner.cpp in and src/scriptvm/) according to the
5 # instrument script (BNF) grammar definition given by src/scriptvm/parser.y and
6 # the terminal symbol scanner/lexer defintion given by src/scriptvm/scanner.l
7
8 SCRIPTS_DIR=`dirname $0`
9 PARSER_SRC_DIR="$SCRIPTS_DIR/../src/scriptvm"
10
11 echo -n "Searching for lexer and parser generator..."
12
13 LEX_CMD=NONE
14 if which "flex" > /dev/null; then
15 LEX_CMD=`which flex`
16 elif which "lex" > /dev/null; then
17 LEX_CMD=`which lex`
18 else
19 echo "Error: You need lex (or flex) to generate the instrument script parser !"
20 exit -1
21 fi
22
23 YACC_CMD=NONE
24 if which "bison" > /dev/null; then
25 YACC_CMD="`which bison` -y"
26 elif which "yacc" > /dev/null; then
27 YACC_CMD=`which yacc`
28 else
29 echo "Error: You need yacc (or bison) to generate the instrument script parser !"
30 exit -1
31 fi
32
33 echo "OK ($LEX_CMD, $YACC_CMD)"
34
35 echo -n "Generating instrument script parser ... "
36 (
37 cd $PARSER_SRC_DIR
38
39 $LEX_CMD scanner.l
40 #mv -f lex.yy.c scanner.cpp
41 mv -f lex.InstrScript_.c scanner.cpp 2>/dev/null
42
43 $YACC_CMD -d parser.y
44 $YACC_CMD parser.y
45 mv -f y.tab.h parser.h 2>/dev/null
46 mv -f y.tab.c parser.cpp 2>/dev/null
47 )
48 echo "Done"

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC