bisonc++ - No production rules? -
i'm trying compile following bisonc++:
%baseclass-preinclude <iostream> %lsp-needed %token number comment keyword variable logicand logicor logicequals doublelesser %token doublegreater mod lesser greater open close negate curlyopen curlyclose semicolon %left equals %left plus minus %left times %left division %% start: expressions { std::cout << "start -> expressions" << std::endl; } ; expressions: // empty { std::cout << "expressions -> epsylon" << std::endl; } | exp expressions { std::cout << "expressions -> exp expressions" << std::endl; } ; exp: number { std::cout << "exp -> number" << std::endl; } | comment { std::cout << "exp -> comment" << std::endl; } | exp logicand exp { std::cout << "exp -> exp logicand exp" << std::endl; } | exp logicor exp { std::cout << "exp -> exp logicor exp" << std::endl; } | exp logicequals exp { std::cout << "exp -> exp logicequals exp" << std::endl; } | exp doublelesser exp { std::cout << "exp -> exp doublelesser exp" << std::endl; } | exp doublegreater exp { std::cout << "exp -> exp doublegreater exp" << std::endl; } | exp plus exp { std::cout << "exp -> exp plus exp" << std::endl; } | exp minus exp { std::cout << "exp -> exp minus exp" << std::endl; } | exp times exp { std::cout << "exp -> exp equal exp" << std::endl; } | exp equal exp { std::cout << "exp -> exp equal exp" << std::endl; } | exp division exp { std::cout << "exp -> exp division exp" << std::endl; } | exp mod exp { std::cout << "exp -> exp mod exp" << std::endl; } | exp lesser exp { std::cout << "exp -> exp lesser exp" << std::endl; } | exp greater exp { std::cout << "exp -> exp greater exp" << std::endl; } | open exp close { std::cout << "exp -> open exp close" << std::endl; } | negate exp { std::cout << "exp -> negate exp" << std::endl; } | curlyopen exp curlyclose { std::cout << "exp -> curlyopen exp curlyclose" << std::endl; } | exp semicolon { std::cout << "exp -> semicolon" << std::endl; } | keyword variable semicolon { std::cout << "exp -> keyword variable semicolon" << std::endl; } ;
however, keeps returning error
') encountered.1] line 1: unrecognized input (` ': identifier or character-constant expected. [bead.y: fatal] line 23: no production rules 134950080
i have production rules , have no idea i'm doing wrong. i've copied of code working example , modified liking. wrong?
your files not unix conform (calculate.l , calculate.y) if you're operating on windows , use nodepad++, following:
- edit/eol conversion/unix format
- encoding/convert files utf-8 without bom
- save , recompile flex , bisonc++
hope helps
Comments
Post a Comment