Compile File .ly

8

I'm compiling a program in Haskell, but it came with a .ly file, and I can not 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 with ghc -c -O Grammar.ly , I 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.

    
asked by anonymous 21.03.2015 / 01:17

1 answer

5

Haskell source files do not usually 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 > ).

This .ly file you actually have is a description of grammars for the parser Happy . Following the tradition of yacc, a parsers generator for C that used the extension .y , Happy's input files come 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 must pass pro ghc. For more information, see Happy documentation .

    
21.03.2015 / 03:47