aboutsummaryrefslogtreecommitdiff
path: root/tools/bison++/Example/MyCompiler.cc
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-19 15:19:19 +0000
committermarha <marha@users.sourceforge.net>2010-11-19 15:19:19 +0000
commitd12ad2fa1165573df95c857ce59f582f964b7cee (patch)
tree8d5546283940c928290a23c50748b3f5c431ef06 /tools/bison++/Example/MyCompiler.cc
parentbd5413c3a7e500fa8c8ccd68a33d2fcc4c172e28 (diff)
parent12f606ce06ef926f366a03079c5e3107c23f18af (diff)
downloadvcxsrv-d12ad2fa1165573df95c857ce59f582f964b7cee.tar.gz
vcxsrv-d12ad2fa1165573df95c857ce59f582f964b7cee.tar.bz2
vcxsrv-d12ad2fa1165573df95c857ce59f582f964b7cee.zip
svn merge ^/branches/released .
Diffstat (limited to 'tools/bison++/Example/MyCompiler.cc')
-rw-r--r--tools/bison++/Example/MyCompiler.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/bison++/Example/MyCompiler.cc b/tools/bison++/Example/MyCompiler.cc
new file mode 100644
index 000000000..3c554bc40
--- /dev/null
+++ b/tools/bison++/Example/MyCompiler.cc
@@ -0,0 +1,32 @@
+#include "MyParser.h"
+#define YY_DECL int yyFlexLexer::yylex(YY_MyParser_STYPE *val)
+#include "FlexLexer.h"
+#include <stdio.h>
+
+class MyCompiler : public MyParser
+{
+private:
+ yyFlexLexer theScanner;
+ public:
+ virtual int yylex();
+ virtual void yyerror(char *m);
+ MyCompiler(){;}
+};
+
+int MyCompiler::yylex()
+{
+ return theScanner.yylex(&yylval);
+}
+
+void MyCompiler::yyerror(char *m)
+{ fprintf(stderr,"%d: %s at token '%s'\n",yylloc.first_line, m,yylloc.text);
+}
+
+int main(int argc,char **argv)
+{
+ MyCompiler aCompiler;
+ int result=aCompiler.yyparse();
+ printf("Resultat Parsing=%s\n",result?"Erreur":"OK");
+ return 0;
+};
+