1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2008-2009 Jean Privat <jean@pryen.org>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 SABLECC3ALTGEN ?
= sablecc3
21 # Preprocess the extended sablecc gramar
22 .nit.sablecc3
: nit.sablecc3xx
25 # Note that parser_nodes is no more automatically synced with the grammar
26 parser.nit
: .nit.sablecc3 xss
/*.xss
27 @
${SABLECC3ALTGEN
-license
} >/dev
/null
2>/dev
/null ||
( echo
"***\n*** sablecc3 altgen version is needed.\n*** Set the environment variable SABLECC3ALTGEN to the executable.\n*** Aborting...\n***" ; exit
1 )
28 @
${SABLECC3ALTGEN} | grep altgen
>/dev
/null
2>/dev
/null ||
( echo
"***\n*** $$SABLECC3ALTGEN is not the sablecc3 altgen version.\n*** Set the environment variable SABLECC3ALTGEN to the executable.\n*** Aborting...\n***"; exit
1 )
29 ${SABLECC3ALTGEN} -c .nit.sablecc3.dump
-t xss
/main.xss
-p usermodule parser_nodes .nit.sablecc3
30 mv
-f
-- parser.nit .parser-nofact.nit
31 .
/fact_parser.pl .parser-nofact.nit
> parser.nit
32 perl
-np
-i.orig
-e
's/([ (\[])P([A-Z])/\1A\2/g;' -e
's/"{"/"\\{"/g;' parser.nit parser_abs.nit parser_prod.nit lexer.nit
35 rm -f
-- .nit.sablecc3 .nit.sablecc3.dump .parser-nofact.nit || true
37 maintainer-clean
: clean
38 @echo
"This command is intended for maintainers to use;"
39 @echo
"it deletes files that may require special tools to rebuild."
40 rm -f
-- parser.nit parser_abs.nit parser_prod.nit lexer.nit || true
43 rm -r org
/nitlanguage
/gen
/analysis
/ org
/nitlanguage
/gen
/lexer
/ org
/nitlanguage
/gen
/node
/ org
/nitlanguage
/gen
/parser
/
44 ${SABLECC3ALTGEN} .nit.sablecc3
-c .nit.sablecc3.dump
45 javac org
/nitlanguage
/gen
/TestParser.java