gren-lang / compiler

Compiler for the Gren programming language
https://gren-lang.org
Other
379 stars 23 forks source link

Parse errors after compiling gren v0.4.5 from source #264

Open Havkost opened 1 week ago

Havkost commented 1 week ago

After installing the gren compiler from source, I get ParseProblem errors when running e.g. gren init. For now I'll try installing from npm instead, and see if that works.

Error message(s)

~/development/gren_project > gren init
gren: ParseProblem "init" (Start 1 1)
CallStack (from HasCallStack):
  error, called at terminal/Main.hs:37:17 in main:Main
~/development/gren_project > gren help
gren: ParseProblem "help" (Start 1 1)
CallStack (from HasCallStack):
  error, called at terminal/Main.hs:37:17 in main:Main

Expected behaviour

gren init should behave like in the gren book, instead of giving an error. At least I would not expect any error to be a parse error in the compiler itself.

Project version (branch and commit)

~/development/installs/gren-compiler > git rev-parse --abbrev-ref HEAD && git rev-parse HEAD
main
22bec1101311c6d9e965f2c28309eedbed28ee1c

ghc and cabal versions (installed with gchup)

~ > ghcup --version
The GHCup Haskell installer, version 0.1.30.0
~ > ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.4.8
~ > cabal --version
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library

Log from cabal install

~/development/installs/gren-compiler > cabal install
Wrote tarball sdist to
/home/havkost/development/installs/gren-compiler/dist-newstyle/sdist/gren-0.4.5.tar.gz
Resolving dependencies...
Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
 - base64-bytestring-1.2.1.0 (lib) (requires download & build)
 - colour-2.3.6 (lib) (requires download & build)
 - hsc2hs-0.68.10 (exe:hsc2hs) (requires download & build)
 - integer-logarithms-1.0.3.1 (lib) (requires download & build)
 - os-string-2.0.6 (lib) (requires download & build)
 - prettyprint-avh4-0.1.1.0 (lib) (requires download & build)
 - primitive-0.9.0.0 (lib) (requires download & build)
 - raw-strings-qq-1.1 (lib) (requires download & build)
 - splitmix-0.1.0.5 (lib) (requires download & build)
 - tagged-0.8.8 (lib) (requires download & build)
 - utf8-string-1.0.2 (lib) (requires download & build)
 - vector-stream-0.1.0.1 (lib) (requires download & build)
 - ansi-terminal-types-0.11.5 (lib) (requires download & build)
 - filelock-0.1.1.7 (lib) (requires download & build)
 - hashable-1.4.7.0 (lib) (requires download & build)
 - random-1.2.1.2 (lib) (requires download & build)
 - foldable1-classes-compat-0.1 (lib) (requires download & build)
 - vector-0.13.1.0 (lib) (requires download & build)
 - ansi-terminal-0.11.5 (lib) (requires download & build)
 - scientific-0.3.8.0 (lib) (requires download & build)
 - edit-distance-0.2.2.1 (lib) (requires download & build)
 - indexed-traversable-0.1.4 (lib) (requires download & build)
 - ansi-wl-pprint-0.6.9 (lib) (requires download & build)
 - gren-0.4.5 (exe:gren) (requires build)
Downloading  colour-2.3.6
Downloaded   colour-2.3.6
Downloading  vector-stream-0.1.0.1
Starting     colour-2.3.6 (lib)
Downloaded   vector-stream-0.1.0.1
Downloading  base64-bytestring-1.2.1.0
Building     colour-2.3.6 (lib)
Downloaded   base64-bytestring-1.2.1.0
Downloading  prettyprint-avh4-0.1.1.0
Starting     base64-bytestring-1.2.1.0 (lib)
Building     base64-bytestring-1.2.1.0 (lib)
Downloaded   prettyprint-avh4-0.1.1.0
Downloading  utf8-string-1.0.2
Starting     prettyprint-avh4-0.1.1.0 (lib)
Building     prettyprint-avh4-0.1.1.0 (lib)
Downloaded   utf8-string-1.0.2
Downloading  raw-strings-qq-1.1
Installing   base64-bytestring-1.2.1.0 (lib)
Completed    base64-bytestring-1.2.1.0 (lib)
Downloaded   raw-strings-qq-1.1
Downloading  primitive-0.9.0.0
Installing   colour-2.3.6 (lib)
Installing   prettyprint-avh4-0.1.1.0 (lib)
Completed    colour-2.3.6 (lib)
Starting     raw-strings-qq-1.1 (lib)
Completed    prettyprint-avh4-0.1.1.0 (lib)
Downloaded   primitive-0.9.0.0
Downloading  splitmix-0.1.0.5
Starting     primitive-0.9.0.0 (lib)
Building     raw-strings-qq-1.1 (lib)
Building     primitive-0.9.0.0 (lib)
Downloaded   splitmix-0.1.0.5
Downloading  random-1.2.1.2
Installing   raw-strings-qq-1.1 (lib)
Starting     splitmix-0.1.0.5 (lib)
Completed    raw-strings-qq-1.1 (lib)
Building     splitmix-0.1.0.5 (lib)
Downloaded   random-1.2.1.2
Downloading  tagged-0.8.8
Downloaded   tagged-0.8.8
Downloading  foldable1-classes-compat-0.1
Starting     tagged-0.8.8 (lib)
Installing   splitmix-0.1.0.5 (lib)
Building     tagged-0.8.8 (lib)
Completed    splitmix-0.1.0.5 (lib)
Starting     utf8-string-1.0.2 (lib)
Downloaded   foldable1-classes-compat-0.1
Downloading  hsc2hs-0.68.10
Building     utf8-string-1.0.2 (lib)
Downloaded   hsc2hs-0.68.10
Downloading  filelock-0.1.1.7
Starting     hsc2hs-0.68.10 (exe:hsc2hs)
Installing   tagged-0.8.8 (lib)
Building     hsc2hs-0.68.10 (exe:hsc2hs)
Completed    tagged-0.8.8 (lib)
Starting     vector-stream-0.1.0.1 (lib)
Downloaded   filelock-0.1.1.7
Downloading  vector-0.13.1.0
Building     vector-stream-0.1.0.1 (lib)
Downloaded   vector-0.13.1.0
Downloading  edit-distance-0.2.2.1
Downloaded   edit-distance-0.2.2.1
Downloading  indexed-traversable-0.1.4
Downloaded   indexed-traversable-0.1.4
Downloading  integer-logarithms-1.0.3.1
Downloaded   integer-logarithms-1.0.3.1
Downloading  os-string-2.0.6
Starting     integer-logarithms-1.0.3.1 (lib)
Installing   utf8-string-1.0.2 (lib)
Building     integer-logarithms-1.0.3.1 (lib)
Downloaded   os-string-2.0.6
Downloading  hashable-1.4.7.0
Starting     os-string-2.0.6 (lib)
Completed    utf8-string-1.0.2 (lib)
Downloaded   hashable-1.4.7.0
Downloading  scientific-0.3.8.0
Building     os-string-2.0.6 (lib)
Downloaded   scientific-0.3.8.0
Downloading  ansi-terminal-types-0.11.5
Installing   integer-logarithms-1.0.3.1 (lib)
Completed    integer-logarithms-1.0.3.1 (lib)
Starting     random-1.2.1.2 (lib)
Downloaded   ansi-terminal-types-0.11.5
Downloading  ansi-terminal-0.11.5
Starting     ansi-terminal-types-0.11.5 (lib)
Installing   primitive-0.9.0.0 (lib)
Installing   vector-stream-0.1.0.1 (lib)
Completed    primitive-0.9.0.0 (lib)
Starting     foldable1-classes-compat-0.1 (lib)
Building     random-1.2.1.2 (lib)
Completed    vector-stream-0.1.0.1 (lib)
Starting     vector-0.13.1.0 (lib)
Building     ansi-terminal-types-0.11.5 (lib)
Building     foldable1-classes-compat-0.1 (lib)
Building     vector-0.13.1.0 (lib)
Downloaded   ansi-terminal-0.11.5
Downloading  ansi-wl-pprint-0.6.9
Downloaded   ansi-wl-pprint-0.6.9
Installing   hsc2hs-0.68.10 (exe:hsc2hs)
Completed    hsc2hs-0.68.10 (exe:hsc2hs)
Starting     filelock-0.1.1.7 (lib)
Building     filelock-0.1.1.7 (lib)
Installing   ansi-terminal-types-0.11.5 (lib)
Installing   foldable1-classes-compat-0.1 (lib)
Completed    ansi-terminal-types-0.11.5 (lib)
Starting     ansi-terminal-0.11.5 (lib)
Completed    foldable1-classes-compat-0.1 (lib)
Starting     indexed-traversable-0.1.4 (lib)
Installing   os-string-2.0.6 (lib)
Completed    os-string-2.0.6 (lib)
Starting     hashable-1.4.7.0 (lib)
Installing   filelock-0.1.1.7 (lib)
Building     ansi-terminal-0.11.5 (lib)
Completed    filelock-0.1.1.7 (lib)
Building     indexed-traversable-0.1.4 (lib)
Building     hashable-1.4.7.0 (lib)
Installing   ansi-terminal-0.11.5 (lib)
Completed    ansi-terminal-0.11.5 (lib)
Starting     ansi-wl-pprint-0.6.9 (lib)
Building     ansi-wl-pprint-0.6.9 (lib)
Installing   ansi-wl-pprint-0.6.9 (lib)
Completed    ansi-wl-pprint-0.6.9 (lib)
Installing   indexed-traversable-0.1.4 (lib)
Completed    indexed-traversable-0.1.4 (lib)
Installing   hashable-1.4.7.0 (lib)
Completed    hashable-1.4.7.0 (lib)
Starting     scientific-0.3.8.0 (lib)
Building     scientific-0.3.8.0 (lib)
Installing   random-1.2.1.2 (lib)
Completed    random-1.2.1.2 (lib)
Starting     edit-distance-0.2.2.1 (lib)
Building     edit-distance-0.2.2.1 (lib)
Installing   scientific-0.3.8.0 (lib)
Completed    scientific-0.3.8.0 (lib)
Installing   edit-distance-0.2.2.1 (lib)
Completed    edit-distance-0.2.2.1 (lib)
Installing   vector-0.13.1.0 (lib)
Completed    vector-0.13.1.0 (lib)
Starting     gren-0.4.5 (exe:gren)
Building     gren-0.4.5 (exe:gren)
Installing   gren-0.4.5 (exe:gren)
Completed    gren-0.4.5 (exe:gren)
Symlinking 'gren' to '/home/havkost/.cabal/bin/gren'

System information

~ > uname -a
Linux archlinux 6.11.4-arch1-1

Hope this helps, if you need more information just say the word.

robinheghan commented 1 week ago

It's my fault for not keeping the documentation up-to-date regarding how to build the project from source.

I made an attempt at updating the documentation here: https://github.com/gren-lang/compiler/pull/265

Does it help?

Havkost commented 4 days ago

Sorry about the wait. Just tried installing the compiler using the new instructions but I seemed to get stuck at step 3.

When running npm run republishOnly, I got the error Expected exactly 1 argument: a json-encoded command.

When running npx --package=gren-lang@0.4.5 -- gren make src/Main.gren --output compiler.js instead, it couldn't find gren; sh: line 1: gren: command not found.

I ran npm install gren-lang and changed the republishOnly script according to the diff proposed by Justin in #265, but got the following error: You have included gren-lang/compiler-node as a local dependency (located at ../compiler-node) but I cannot find a gren.json file at that location.

After this, I also realized I had node v22 installed instead of v20, that might be my issue, maybe not. I'm not really interested in more debugging at the moment, just wanted to try out the language. Enjoying it so far, even though my experience with purely functional languages is wanting.

Keep it up :)

robinheghan commented 4 days ago

You have included gren-lang/compiler-node as a local dependency (located at ../compiler-node) but I cannot find a gren.json file at that location.

This likely meant it worked, it's just that the current master branch uses some local dependencies which haven't been tagged yet.

I'm sorry for the bad experience. I haven't been very careful with keeping the main in a stable state, I'll be more careful in the future.