Skip to content

A simple recursive descent parser for accepting all nested-if commands implemented in C.

Notifications You must be signed in to change notification settings

JessieJolly/RecursiveDescentParserForNestedIf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

RecursiveDescentParserForNestedIf

A simple recursive descent parser for accepting all nested-if commands implemented in C.

Input

The input for the program is given in the format:

if ( c ) { if ( c ) {...if ( c ) { stmt ; } else { stmt ; }...} else { stmt ; } } else { stmt; }

Grammar

The grammar for nested-if used is given below. The code is implemented using the following grammar:

S' --> S | SS'
S --> B | B else { S } | A
B --> if ( c ) { S }
A --> stmt;

Running code

The code is written in C and can be run in terminal using the following commands:

>gcc rdpnestedif.c -o rdp
>./rdp

Output

image

About

A simple recursive descent parser for accepting all nested-if commands implemented in C.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages