#!/usr/bin/env python ## ## This file is part of Mipsy, a tiny MIPS simulator ## Copyright (C) 2003 Benoit Perrot ## ## Mipsy is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## Mipsy is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## import sys import string, re import mipsy from mipsy import license, depth, define_id #### Mipsy's Bison assembly parser generator --------------- parser = mipsy.InstructionSetParser() instructions = parser.parse(sys.stdin) ## Prologue -------------------------- print "%{ // -*- C++ -*-" print license print """ #include #include \"common.hh\" #include \"inst/label.hh\" #include \"inst/program_builder.hh\" #include \"inst/exp.hh\" #include \"inst/register.hh\" #include \"inst/all.hh\" #include \"vm/cpu.hh\" #include \"parse/libparse.hh\" namespace yy { extern inst::ProgramBuilder program_builder; } using namespace inst; using vm::Cpu; %} %error-verbose %locations %debug %union { int i; std::string *s; inst::Label *label; inst::Register *reg; inst::Exp *exp; } %{ #include \"parse/asm-scan.hh\" %} %token