Compile Archive . ly

Asked

Viewed 87 times

8

I’m compiling a program in Haskell, but came a file .ly, and I can’t compile it. I try ghc Grammar.ly

And I get the message:

ld: warning: ignoring file Grammar.ly, file was built for unsupported file format ( 0x3E 0x20 0x7B 0x0D 0x0A 0x3E 0x20 0x6D 0x6F 0x64 0x75 0x6C 0x65 0x20 0x47 0x72 ) which is not the architecture being linked (x86_64): Grammar.ly
Undefined symbols for architecture x86_64:
  "_ZCMain_main_closure", referenced from:
      _main in ghc11930_2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I try to ghc -c -O Grammar.ly, get the message:

Warning: the following files would be used as linker inputs, but linking is not being done: Grammar.ly

ghc: no input files Usage: For basic information, Try the `-help' option.

  • 1

    For these compile error questions, the more information the better. In particular, presenting the code you are using so we can reproduce your problem helps a lot.

1 answer

5


Haskell source files notmalmente have the extension .hs (for normal Haskell files) or .lhs (for "literate" files, where the default for each line is to be a comment and lines of code are marked with >).

That file .ly that you have actually is a grammar description for parsers generator Happy. Following the tradition of Yacc, a parser generator for C that used the extension .y, Happy input files with extensions .y or .ly (for the "literate version").

To compile your grammar file simply use happy instead of ghc.

happy Grammar.ly

The output should be a "Grammar.hs" file that you should pass pro ghc to. For more information, see happy documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.