Skip to content

dhwanitgupta/PL_Zero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation of PL/0 http://en.wikipedia.org/wiki/PL/0 using lex and yacc

GRAMMAR

program = block "." .

block = [ "const" ident "=" number {"," ident "=" number} ";"] [ "var" ident {"," ident} ";"] { "procedure" ident ";" block ";" } statement .

statement = [ ident ":=" expression | "call" ident | "?" ident | "!" expression | "begin" statement {";" statement } "end" | "if" condition "then" statement | "while" condition "do" statement ].

condition = "odd" expression | expression ("="|"#"|"<"|"<="|">"|">=") expression .

expression = [ "+"|"-"] term { ("+"|"-") term}.

term = factor {("*"|"/") factor}.

factor = ident | number | "(" expression ")".

Compile using make.sh

and run ./a.out < inputfile

About

Implementation of PL_Zero Compiler using Lex & Yacc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published