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

fixes #34; Remove number and string literal suffixes #36

Merged
merged 12 commits into from
Aug 29, 2024
Merged

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Aug 27, 2024

fixes #34

  • nif
  • nifreader
  • nifbuilder
  • ......
  • remove suffix for ints and floats from gear2, nifc and undone the APIs
  • documentaion
echo (12'u32, 12.3, 12e2, 7.5f32, "123", r"debility")

nif sample output

(.nif24)
(.vendor "Nifler")
(.dialect "nim-parsed")
@0,1,/home/wind/defs/Nim/nif/test.nim(stmts
 (cmd
 echo @5(tupleConstr
 @1 (suf 12 "u32")@9 12.3 @15 1200.0 @21 7.5 @29"123" @36(suf
 "debility" "R"
)
)
)
)

nifbuilder sample output

(.nif24)
(.vendor "tester")
(.dialect "niftest")

(stmts @4,5,mymodb.nim
 (call @1,3,mymod.nim foo.3.mymod 3423
  (suf 3423 "u32")

nifreader sample

(stmts
 (cmd
  Ident:echo (tupleConstr
   (suf
    IntLit:12 StringLit:u32) FloatLit:12.3 FloatLit:1200.0 StringLit:123 (suf
    StringLit:debility StringLit:R))))

doc/nif-spec.md Outdated
@@ -194,13 +194,15 @@ Grammar:

```
Digit ::= [0-9]
NumberSuffix ::= [a-z]+ [0-9a-z]* # suffixes can only contain lowercase letters
NumberSuffix ::= '"' [a-z]+ [0-9a-z]* '"' # suffixes can only contain lowercase letters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NumberSuffix can only be u for "unsigned", nothing else exists, the suf tree is not part of the lexing step.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the suf tree is not part of the lexing step.

What does this mean? Do you mean the suf tree is handled by nifc/gear2/...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member Author

@ringabout ringabout Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh, I cannot compile gear2

nim c -r nif/src/gear2/bridge.nim

Error: not all cases are covered; missing: {nkOpenSym}

Error: redefinition of 'TypeOf2'; previous declaration here: /home/wind/defs/Nim/nif/src/gear2/tags.nim(623, 3)

Copy link
Member Author

@ringabout ringabout Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed gear2/gen2nif. gear2/genToNim seems to be incomplete.

let progress = parse(r, d[], m, currentInfo)
if not progress: break

if kind == SufC:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason for this special logic here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I can let codegen handle SufC

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

@ringabout ringabout marked this pull request as ready for review August 29, 2024 11:24
@Araq
Copy link
Member

Araq commented Aug 29, 2024

Ok, taking over from here.

@Araq Araq merged commit 3a1a4f8 into master Aug 29, 2024
3 checks passed
@Araq Araq deleted the pr_nif_suffix branch August 29, 2024 19:59
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.

Remove number and string literal suffixes
2 participants