Home | History | Annotate | Download | only in compiler
      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 
     18 run_flex()
     19 {
     20 input_file=$script_dir/$1.l
     21 output_source=$script_dir/$1_lex.cpp
     22 flex --noline --nounistd --outfile=$output_source $input_file
     23 }
     24 
     25 run_bison()
     26 {
     27 input_file=$script_dir/$1.y
     28 output_header=$script_dir/$1_tab.h
     29 output_source=$script_dir/$1_tab.cpp
     30 bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file
     31 }
     32 
     33 script_dir=$(dirname $0)
     34 
     35 # Generate Parser
     36 run_flex glslang
     37 run_bison glslang
     38