8

This is my code in file skener.y

 %{
#include <stdio.h>
%}
%token T_Int
%%

exp:      T_Int           { $$ = $1;         }
| exp exp '+'     { $$ = $1 + $2;    }
| exp exp '-'     { $$ = $1 - $2;    }
| exp exp '*'     { $$ = $1 * $2;    }
| exp exp '/'     { $$ = $1 / $2;    }

;
%%

When I compile it with comand "bison -d skener.y" I get error "m4: No such file or directory.". Of course I am located in working folder when typing command in prompt. I dont know what is it about?

Bodo Hombah
  • 209
  • 1
  • 3
  • 9

6 Answers6

9

There seems to be some error in the bison.exe file. I replaced it with the one found inside this zip file. http://marin.jb.free.fr/bison/bison-2.4.1-modified.zip

Source:http://marin.jb.free.fr/bison/

Tarun Gehlaut
  • 1,292
  • 10
  • 16
4

There should be no space in the name of any folder in the path. In my case I kept it in C:/Program Files/GnuWin32/bin and it caused the error. Then I moved the folder from Program Files and placed as C:/GnuWin32/bin and it starts working well.

3

I got this same error when I installed the GnuWin32 version of bison via their Setup.exe on my Windows 7 PC. The solution was to add the ...\GnuWin32\bin dir to my PATH. (Interestingly, this is first tool of many that had a problem when not in my PATH)

jfritz42
  • 5,913
  • 5
  • 50
  • 66
  • This was part of the problem for me. Tarun's solution was the other part. I just modified the path within my batch file that calls BISON. Thanks for this tip. – Richard Mar 12 '18 at 19:07
2

In my case, I solved it following the jfritz42 answer, but had to add the

...\MinGW\bin
path too to my System Environment Variables...

Let screenshots of my case, hope it helps:)

Step 1

Step 2

Step 3

hfunes.com
  • 168
  • 1
  • 3
  • 11
1

Moved the Folder from

C:\Program Files(x86)\GnuWin32 

to

C:\GnuWin32

then, added PATH values to both user variables and system variables as:

C:\GnuWin32\bin
Machavity
  • 30,841
  • 27
  • 92
  • 100
harshu
  • 61
  • 4
0

It means that you haven't installed bison properly -- you have an executable, but it is missing its support files.

Go back and reinstall bison.

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226