Skip to content

samibadra/Grammar-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

Copyright 2015 Sami Badra. All Rights Reserved.

Sami Badra: masc0673
CS 530, Spring 2015
Assignment #3, parser
FILE: README

##Description This program will determine if a certain input is valid for the set of grammar rules found below. The program will output “Successful parse” if the input is correct. If not, it will identify where the error was encountered and identify what kind of error it was.

##Grammer Rules ::= {}$ ::= char = ; ::= {( + | - ) } ::=

{( * | / )

}

::= ^

| ::= char | ( ) | digit

NOTE: It is important to note that the operands can only consist of single numeric digits, and SINGLE alphabetic characters, separated by an operator (i.e. = + - * / ^).

This is a grammar for a simple language consisting of a sequence of assignment statements, terminated by semicolons. The whole program is terminated by the symbol ‘$’.

##Sample Input a = 6; e = m * c^2; c = h^ (t-5+ (g^n-9) +k^4 *u); $

z= u-9 ; y = 5-t^(h-8*j+6) / k^3; u=o-l; k=5-l/8; $

##Operating Instructions

  1. Compile and run the program (with no arguments)
  2. Program will ask for user to input a sentence to parse
  3. Enter one or more expressions on one line, each followed by ';'
  4. Put a '$' sign at the end of the last expression in the sentence, and click enter
  5. Program outputs "Successful parse" if sentence is correct, ERROR otherwise

About

A parser for expressions with single digits and characters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages