-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve a tiny bit testbisoncp.yy & added testb.hh
- Loading branch information
Showing
3 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,19 @@ | |
// ©2023 CEA and Basile Starynkevitch <[email protected]> and | ||
// <[email protected]> | ||
|
||
#include <iostream> | ||
#include <unistd.h> | ||
#include <time.h> | ||
#include "testb.hh" | ||
|
||
|
||
void tb_fatal_error_at(const char*fil, int lin) | ||
{ | ||
std::clog << progname << " ***°°°*** FATAL ERROR AT " << fil << ":" << lin | ||
<< std::endl; | ||
abort(); | ||
} // end tb_fatal_error_at | ||
|
||
int | ||
main(int argc, char**argv) | ||
{ | ||
progname = argv[0]; | ||
gethostname(myhost, sizeof(myhost)); | ||
} // end main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/// file misc-basile/ExBisonCpp/testb.hh | ||
|
||
#include <fstream> | ||
#include <iostream> | ||
#include <ostream> | ||
#include <sstream> | ||
#include <cstring> | ||
#include <map> | ||
#include <string> | ||
#include <memory> | ||
#include <iostream> | ||
#include <unistd.h> | ||
#include <time.h> | ||
|
||
#include <unistd.h> | ||
#include <assert.h> | ||
#include <fcntl.h> | ||
#include <sys/stat.h> | ||
#include <sys/wait.h> | ||
#include <getopt.h> | ||
|
||
char myhost[80]; | ||
const char*progname; | ||
extern "C" [[noreturn]] void tb_fatal_error_at(const char*fil, int lin); | ||
#define TB_FATAL_AT(Fil,Lin,Log) do { \ | ||
std::ostringstream out##Lin; \ | ||
out##Lin << Log << std::endl; \ | ||
std::clog << "FATAL ERROR (" << progname << ") " \ | ||
<< Log << std::endl; \ | ||
tb_fatal_error_at(Fil,Lin); \ | ||
} while(0) | ||
|
||
#define TB_BISFATAL_AT(Fil,Lin,Log) TB_FATAL_AT((Fil),Lin,Log) | ||
|
||
#define TB_FATAL(Log) TB_BISFATAL_AT(__FILE__,__LINE__,Log) | ||
|
||
|
||
class TbParser { | ||
#warning missing code for class TbParser; | ||
std::string tbpars_source; | ||
public: | ||
TbParser(std::string src): tbpars_source(src) { | ||
}; | ||
virtual ~TbParser() { | ||
}; | ||
virtual void output(std::ostream&out); | ||
}; | ||
|
||
inline std::ostream& operator << (std::ostream&out, TbParser&tbp) { | ||
tbp.outpout(out); | ||
return out; | ||
}; | ||
// ©2023 CEA and Basile Starynkevitch <[email protected]> and | ||
// <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,20 @@ | |
// ©2023 CEA and Basile Starynkevitch <[email protected]> and | ||
// <[email protected]> | ||
|
||
%thread-safe | ||
%error-verbose | ||
%baseclass-preinclude "testb.hh" | ||
%class-header "_tb-parser.h" | ||
%implementation-header "_tb-parsimpl.h" | ||
%class-name "TbParser" | ||
%debug | ||
%polymorphic | ||
%print-tokens | ||
%% ///// this part has grammar rules | ||
|
||
%start input | ||
|
||
input: // empty | ||
; | ||
|
||
///// end of file misc-basile/ExBisonCpp/testbisoncp.yy |