Dear Tubes, Please help.
So I'm playing with Yacc for the first time. I'm learning from the Flex and Bison manuals. I own the dragon book but I haven't cracked it open yet (which may be part of my problem).
As a first project I'm trying to build a parser for the output of a game I play. I can't redefine the language. In fact I don't have a
(
Read more... )
Still got questions? I just wrote an assembler for a custom computer design. I made the syntax capable of RPN and infix expression analysis. The assembly language I created is very similar to B and not as advanced as C. If your interested, I may be able to share bits of it. I can show you on Tuesday.
Reply
I just put up the actual current version. It's not exactly the same as the initial example but it's equivalent. I also put up the code and data file that the initial example came from.
ftp://frontiernet.net/pub/users/rreay/CoHParserFails.zip
Reply
Reply
Is HPMAX always the end of one of these funky long chain of records? More to the point, is NEW always the start of a new chain? You're going to have to reflect that in the grammar, or you'll still get shift/reduce errors.
The parser has to decide, at the end of one of these records, whether it's done or if it continues to the next line. You might make a rule that matches all the possible commands that follow in a given case, ensuring that there's no NEW or such in there. Then, the parser can read ahead (a whole fucking lot), see the NEW (or end of file), and backtrack with all the intervening records being marked together in the same pattern.
Reply
NEW is always the first token in a chain that defines a character. So of the actions between the NEW and HPMAX can occur outside them, but others like PARTSNAME can't
So yeah, I think I see how I can define an in_character_valid non terminal that can by used in a character. The parser can detect a new class of errors and can mark everything associated with that character.
Reply
Reply
Leave a comment