gren-lang / gren-lang/compiler-common

New parser: A variable name starting with "as" is okay as the 1st variable in a function but not the 2nd.

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
No language data
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

The following code compiles fine with the Haskell-based compiler:

module Main exposing (good, bad)

import Array

good : Int -> Int -> Int
good as_ bs =
    as_ + bs

bad : Int -> Int -> Int -> Int
bad x as_ bs =
    x + as_ + bs

as seen in:

% gren make Main                                                   
Success! Compiled 1 module.

But the new compiler-common parser thinks the "as" in "as_" (as the 2nd argument in the "bad" function) is a reserved keyword and doesn't like the "_" after it:

% ~/prj/gren-format/gren-format/gren-format.sh --show src/Main.gren
-- FAILED TO PARSE ----------------------------------------------- src/Main.gren

 8| 
 9| bad : Int -> Int -> Int -> Int
10| bad x as_ bs =
            ^
11|     x + as_ + bs
12| 

Invalid character in variable name

But it has no problem with the "as_" in the "good" function where it is the 1st argument.

This file can be found in the 2026-06-30-trailing_underscore directory in this repo: https://github.com/gilramir/gren-bug-reports

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the parser failure with gren-format.sh using src/Main.gren from the 2026-06-30-trailing_underscore directory. Start by tracing how variable names are parsed in the compiler-common parser, then verify that as_ is accepted in both argument positions while the supplied example still parses successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.