Short vitae
I'm Damien Riquet , 24 years old, a PhD. Student within the 2XS research group at the University of Lille 1 (France). I hold a Master Degree (french equivalent of an MSc) in Computer Science from the University of Lille 1.
My PhD (funded by the French Research Ministry), under the supervision of Gilles Grimaud and Michaël Hauspie , is about including Embedded probes for Cloud Security .
This website presents my research interests, publications and some blog entries.
Lun 10 décembre 2012
In Compiler .
Tags: flex bison yacc lex python scons
While working with Flex and Bison to build a compiler, I wanted to stick with Python a little.
That's why I use Scons to build C/C++ files and the final application.
I did not find any complete Sconstruct file to build such application, that's why I want to share mine.
The following SConstruct file (configuration file for Scons) could be used to compile the Flex/Bison example written by Timo Bingmann .
# -*- coding: utf-8 -*-
# Damien Riquet (d.riquet@gmail.com)
# WTFPL Licence
# December, 2012
# SConstruct file to compile a compiler
# Here, we use Flex and Bison to do this
# Scons knows flex as lex and bison as yacc (older versions)
# This file has been designed to compile the Flex/Bison example written by Timo Bingmann
# It can be found here: http://panthema.net/2007/flex-bison-cpp-example/
# 0) Build environment
# --------------------
env = Environment ()
# Add a Bison (yacc) flag so that it creates an header file (parser.h)
env . Append ( YACCFLAGS = '--defines=parser.h' )
# g++ compile flags
env . Append ( CXXFLAGS = "-W -Wall -Wextra -ansi -g" )
# List of source files needed for the final compilation
sources = [ "driver.cc" , "exprtest.cc" ]
# 1) Generate C++ files from lexer and analyzer files
# --------------------
# We use here the CXXFile class that uses flex or bison accordingly to the source file
sources += env . CXXFile ( source = 'scanner.ll' )
sources += env . CXXFile ( source = 'parser.yy' )
# 2) Build the application thanks to Program class
# --------------------
env . Program ( "exprtest" , sources )
Feel free to use this code. Beerware / WTFPL licence.
Comment(s)
Page 1 / 1
Proudly powered by Pelican , which takes great advantage of Python .
The theme is by Smashing Magazine , thanks!