Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python help. need to create this program Language for propositional language In this homework you are to implement lexer and parser for a simple language.
python help. need to create this program
Language for propositional language In this homework you are to implement lexer and parser for a simple language. Token definitions: ID = [A-Z]+ LAPR = ( RPAR-) NOT! AND = N OR=V IMPLIES Grammar propositions proposition more-proposition more-proposition-) , propositions roposition - atomic | compound atomic 0 | 1 | ID compound - atomic connective proposition | LPAR proposition RPAR NOT proposition connective AND | OR IMPLIES | IFF The start variable is propositions. Your implementation should receive a file, if the input file is a valid program, it should print the parse tree in prefix order, otherwise it should return "Syntax Error" message along with the line and column numbers of the first error. Instructions: Use Python 2.7 for implementation Language for propositional language In this homework you are to implement lexer and parser for a simple language. Token definitions: ID = [A-Z]+ LAPR = ( RPAR-) NOT! AND = N OR=V IMPLIES Grammar propositions proposition more-proposition more-proposition-) , propositions roposition - atomic | compound atomic 0 | 1 | ID compound - atomic connective proposition | LPAR proposition RPAR NOT proposition connective AND | OR IMPLIES | IFF The start variable is propositions. Your implementation should receive a file, if the input file is a valid program, it should print the parse tree in prefix order, otherwise it should return "Syntax Error" message along with the line and column numbers of the first error. Instructions: Use Python 2.7 for implementationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started