문제

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