Skip to content

Why is this for semantics rule of number = digit+ ("." digit+)?? #347

Answered by pdubroy
panlina asked this question in Help
Discussion options

You must be logged in to vote

I'm really sorry that it took so long to answer this 😬

It is as if expressions in ? are expanded in place.

Yes, that's how Ohm works. The main reason for this is that it's unclear how you would write a separate semantic action for the ? expression separately.

  • I expect dot and decimal referring to the dot and the decimal part respectively, but as I inspected, both dot.sourceString and decimal.sourceString are ".456" with test case 123.456, while dot.children[0].sourceString and decimal.children[0].sourceString are "." and "456" respectively. This looks strange to me, because there's no such thing whose only child is ./456 while its source is .456. Why is it?

You're right that it does…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pdubroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #249 on January 06, 2022 07:27.