Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Improve parse error #20

Merged
merged 1 commit into from
Oct 9, 2024
Merged

[WIP] Improve parse error #20

merged 1 commit into from
Oct 9, 2024

Conversation

seanmcl
Copy link
Contributor

@seanmcl seanmcl commented Oct 9, 2024

Attempts to address #19 Currently reports the column of the closing quote of the operator. Not amazing, but also not clear how to get the starting column. Perhaps it's embedded in the hd of state.trace but I haven't grokked the parser enough yet to know.

Definitely open to feedback on this one!

Example:

"builtin.module"() ({
  "func.func"() <{function_type = (tensor<28x28xf32>, tensor<784x10xf32>, tensor<1x10xf32>) -> tensor<1x10xf32>, sym_name = "main"}> ({
  ^bb0(%arg0: tensor<28x28xf32>, %arg1: tensor<784x10xf32>, %arg2: tensor<1x10xf32>):
    %0 = "stablehlo.reshape"(%arg0) : (tensor<28x28xf32>) -> tensor<1x784xf32>
    %1 = "stablehlo.dot"(%0, %arg1) : (tensor<1x784xf32>, tensor<784x10xf32>) -> tensor<1x10xf32>
    %2 = "stablehlo.add"(%1, %arg2) : (tensor<1x10xf32>, tensor<1x10xf32>) -> tensor<1x10xf32>
    %3 = "stablehlo.constant"() <{value = dense<0.000000e+00> : tensor<1x10xf32>}> : () -> tensor<1x10xf32>
    %4 = "stablehlo.foo"(%2, %3) : (tensor<1x10xf32>, tensor<1x10xf32>) -> tensor<1x10xf32>
    "func.return"(%4) : (tensor<1x10xf32>) -> ()
  }) : () -> ()
}) : () -> ()
Parsing error line 8, column 23 : Unknown op code: 'foo'

Attempts to address leanprover#19
Currently reports the column of the closing quote of the operator.
Not amazing, but also not clear how to get the starting column.
Perhaps it's embedded in the hd of `state.trace` but I haven't
grokked the parser enough yet to know.

Definitely open to feedback on this one!
@seanmcl seanmcl requested a review from jtristan as a code owner October 9, 2024 18:20
@jtristan jtristan merged commit cf77ce5 into leanprover:main Oct 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants