1#!/bin/bash
2# Copyright 2016 The SwiftShader Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#    http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# Generates GLSL ES parser - glslang_lex.cpp, glslang_tab.h, and glslang_tab.cpp
17
18run_flex()
19{
20input_file=$script_dir/$1.l
21output_source=$script_dir/$1_lex.cpp
22flex --noline --nounistd --outfile=$output_source $input_file
23}
24
25run_bison()
26{
27input_file=$script_dir/$1.y
28output_header=$script_dir/$1_tab.h
29output_source=$script_dir/$1_tab.cpp
30bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file
31}
32
33script_dir=$(dirname $0)
34
35# Generate Parser
36run_flex glslang
37run_bison glslang
38