Giter VIP home page Giter VIP logo

compilers-assignment's Introduction

A scanner/parser for PLATYPUS programs written for CST8152

Compile in ANSI C

Use with ./platyc <input_file>

View the other branch for the C transpiler version

Example ouput:

Reading file ../data/input_files/ass3r.pls ....Please wait

Printing input buffer parameters:

The capacity of the buffer is:  466
The current size of the buffer is:  466

Printing input buffer contents:

!!This is a syntactically correct PLATYPUS program
!!Weiler's law:
!!"Nothing is impossible for the man who doesn't have to do it himself."
!!"Parsing is passing." S^R & Compilers' law

PLATYPUS{
 a=-000;
 b=+0.;
 READ(c);
 READ(d,e,f);
 c=((d+e)/a)*f-(((d-e)*a)/f);
 WHILE TRUE(a<>b .OR. c==d .AND. e<f .OR. a>0)REPEAT{
   IF TRUE(a==1 .AND. b==0.0)THEN{
    c=-(5.9);
   }ELSE {c=-c;};  
 };   
 WRITE();
 WRITE("Results: ");
 WRITE(d,e,f,a);
}?

Parsing the source file...

PLATY: Primary arithmetic expression parsed
PLATY: Unary arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Assignment expression (arithmetic) parsed
PLATY: Assignment statement parsed
PLATY: Primary arithmetic expression parsed
PLATY: Unary arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Assignment expression (arithmetic) parsed
PLATY: Assignment statement parsed
PLATY: Variable list parsed
PLATY: Input statement parsed
PLATY: Variable list parsed
PLATY: Input statement parsed
PLATY: Primary arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Additive arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Multiplicative arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Multiplicative arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Additive arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Multiplicative arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Multiplicative arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Additive arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Assignment expression (arithmetic) parsed
PLATY: Assignment statement parsed
PLATY: Primary a_relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Relational expression parsed
PLATY: Logical AND expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Relational expression parsed
PLATY: Logical OR expression parsed
PLATY: Logical OR expression parsed
PLATY: Conditional expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Primary a_relational expression parsed
PLATY: Relational expression parsed
PLATY: Logical AND expression parsed
PLATY: Conditional expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Primary arithmetic expression parsed
PLATY: Unary arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Assignment expression (arithmetic) parsed
PLATY: Assignment statement parsed
PLATY: Primary arithmetic expression parsed
PLATY: Unary arithmetic expression parsed
PLATY: Arithmetic expression parsed
PLATY: Assignment expression (arithmetic) parsed
PLATY: Assignment statement parsed
PLATY: Selection statement parsed
PLATY: Iteration statement parsed
PLATY: Output list (empty) parsed
PLATY: Output statement parsed
PLATY: Output list (string literal) parsed
PLATY: Output statement parsed
PLATY: Variable list parsed
PLATY: Output statement parsed
PLATY: Program parsed
PLATY: Source file parsed

Collecting garbage...

compilers-assignment's People

Contributors

nicksturgeon avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.