How to install Bison on Replit
I've been following a tutorial online on how to create a simple compiler using Lex, Bison, and LLVM, but I've been unable to get Bison working. I was able to install it through install-pkg bison
, but when I try to run it with bison -d -o parser.cpp parser.y
, it gives my an error saying bison: /usr/share/bison/m4sugar/m4sugar.m4: cannot open: No such file or directory
. Does anyone know a way to get bison working on Replit?
What a coincidence, I was working on a parser the other day as well!
In order to get Bison
on Replit, you need to use install-pkg
in the shell tab. The following commands let me use flex
, yacc
, and bison
commands, they should work for you too.
install-pkg bison install-pkg flex install-pkg byacc
NOTE: flex
is a mirror of lex
, you can't get lex on Replit right now. (If you can I don't know how)
@frissyn I'm still getting the same error when I try to use Bison. Are you able to use it?
@ANDREWVOSS Apparently this is an issue with Bison itself and not Replit. I got this issue today but it was working before, so I don't know what's wrong
@CodeMaster007 This is for installing Bison and related packages. These are language-independent tools you run in the shell tab
@frissyn Oh. Well tell me if you figure out a fix.
sewgfuiahowif]e
]\
Clone it from github and play around with the build files. Build it, and make a custom configuration that works on replit.
Hey, so after reading some about bison, I found that bison is supposed to run on C, C++, or java. There are a bunch of cool features and abilities but I didn't see anything regarding python. I think your problem is that it doesn't run on python. I may be wrong, but from my research, theres little work done on python. On repl, I didn't find anything at all about bison so the chances of making it work is pretty low. I may be wrong, but I just suggest using java of c++. They are relatively easy programs to learn and there are millions of tutorials on it.
Good Luck,
CodeMaster007
@CodeMaster007 OP is already using C++ :/
Python's bison isn't the same thing as the bison parsing tool.
https://pypi.org/project/bison/
What about this?
@CodeMaster007 I think that's something completely different, the Bison I'm looking for is for generating parsers, but that is for reading config files.
Try this after installing:
export BISON_PKGDIR=$HOME/.apt/usr/share/bison
@programmeruser The file doesn't exist
@ANDREWVOSS I edited my answer, try again
@programmeruser I was wrong. The file exists in the path you put in your answer, but Bison still looks in the default path even after I export the environment variable.
@ANDREWVOSS what are you doing after exporting the environment variable?
@programmeruser Running Bison. The exact command is
bison -d -o parser.cpp parser.y
.@ANDREWVOSS what error message does it show exactly?
@programmeruser
bison: /usr/share/bison/m4sugar/m4sugar.m4: cannot open: No such file or directory
, same as in the original post.@ANDREWVOSS Use BISON_PKGDATADIR instead of BISON_PKGDIR
@RowanFromBJC Ok, I'll give that a shot
@RowanFromBJC It worked! Thanks