質問

I am trying to figure out the correct way to write the EBNF description for a C float literal.

This is the one problem that I am stuck on. I am not sure how to write it because isn't float just a type? So far I am thinking it may just be

float < literal >

But that seems way too simple.

役に立ちましたか?

解決

Yes, from a viewpoint of a parser, a floating point ltieral would generally just be another token.

Figuring out that a particular sequence of input characters was a floating point literal would normally be done by the lexer. It's not as trivial as you'd like, but still pretty much a one-liner using a regex.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top