Code Monkey home page Code Monkey logo

sherlemious / igcse-cs-pc-transpiler Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 7.0 3.85 MB

IGCSE CS PseudoCode Interpreter (Translator) Note. This program is currently undergoing the final tweaks. This Program transpiles (compiles source to source) the Pseudocode syntax studied in the IGCSE Computer Science 0478 Syllabus as no other application is available to do this. For any suggestions or bug reports, please send me a message on Github If you liked it, please don't forget to star this repository. Thanks!

License: GNU Affero General Public License v3.0

Python 100.00%
python python3 pseudocode transpiler igcse computerscience beginner-project beginner-friendly good-first-issue translates

igcse-cs-pc-transpiler's Introduction

IGCSE CS PseudoCode Transpiler forthebadge made-with-python

This program translates the Pseudocode syntax studied in the IGCSE Computer Science 0478/0984 Syllabus.

Note

This program is usage-ready with just a couple additional features under development. For any suggestions or bug reports, please submit an issue on GitHub.

If you liked it, please don't forget to star this repository. Thanks!

Prerequisites

Python 3

How to use

Syntax

For starters, it is required to leave a space character between each variable, function or operator. For example, when assigning a value to a variable, this is the correct way to do it.

variable = 16 * 14 + variable2

While this, on the other hand, will not work.

variable=16*14+variable2
Arrays (example):
Numbers = [ 3, 4 ]
Numbers[Count] = 123
INPUT Numbers[3]

Available Functions

PRINT (Fully functional):

This is a simple statement use as in the following examples

PRINT "HELLO WORLD !"

The OUTPUT keyword also works

OUTPUT "HELLO WORLD !"

To print the string between two quotation marks " ".

Note that you should *never put quotations within pre-existing quotations and/or use a backslash character "\".

It is also possible to print/output the contents of a variable.

PRINT Variable

The OUTPUT keyword also works

OUTPUT Variable

To print multiple strings, or variable or both, separate them using commas. sum = 99

PRINT "The sum is equal to:" , sum

Output: The sum is equal to: 99

Note that spaces are automatically added between printed entites

INPUT (Fully functional):

This is a simple statement that can be used as in the following example.

INPUT Variable

The keyword, "USERINPUT", can also be used.

Variable = USERINPUT

IF (Fully functional):

A conditional statement that carries out a number of statements between the IF statement and the ENDIF statement. The ELSE statement will also be functional.

IF I = T THEN
PRINT "HELLO WORLD !"
I = I + 1
ELSE
"Print Hello"
ENDIF

(The 'THEN' keyword is optional)

FOR Loop (Fully functional):

This is to repeat a number of statements, which are inserted between the FOR "LCV" = "Start" TO "End" and the NEXT "LCV", for a set number of times.

FOR I = 1 TO 5
PRINT "HELLO WORLD !"
NEXT I

WHILE Loop (Fully functional):

A conditional loop that is repeated as long as a condition is true. Any statements should be inserted between the WHILE "Condition" and the ENDWHILE STATEMENT.

WHILE I < 5 DO
PRINT "HELLO WORLD !"
I = I + 1
ENDWHILE

(The 'DO' keyword is optional)

REPEAT Loop (Fully functional):

A conditional loop that is repeated until a certain condition is met. Any statements should be inserted between the REPEAT and the UNTIL statement.

REPEAT
PRINT "HELLO WORLD !"
I = I + 1
UNTIL I = 5

Commenting (Functional):

Comments should be preceded by two slashes and a space character as follows.

// This is a comment

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

igcse-cs-pc-transpiler's People

Contributors

abdulmabdi avatar bangyen avatar deepsourcebot avatar mahdeensky avatar obitorasu avatar sherlemious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

igcse-cs-pc-transpiler's Issues

Add support to CASE..OF..ENDCASE statements.

This should be a pretty simple statement with a variable that is compared to each of the values at the beginning of each of the lines preceding the ENDCASE statement.
Lines Executed should either be assignment or output statements. This means that It will not allow recursion of any sorts which is not required for the syllabus.

(FLK-E722) Do not use bare `except`, specify exception instead

Description

Using except without a specific exception can be error-prone.

Occurrences

There is 1 occurrence of this issue in the repository.

Commands.py

322                to_be_eval += " " + str(V)
323        try:
324            to_be_eval = eval(to_be_eval)
325        except:
326            pass
327
328        if array:

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.