/codeBlocks

Primary LanguageJavaScript

About project

This is a web engineering assignment that uses drag and drop items to create a simple GUI to generate and execute PHP code.

Tools used

HTML/CSS have been used for the styling whereas Javascript has been used for the php code generation and drag-and-drop implementation. The generated php code runs on xammp/wamp servers.

Components implemented

Different components of PHP language have been implemented. These are:

Compoenents that allow nesting

  • Conditional statements
  • Functions
  • Loops

Components that do not allow nesting

  • Function calls
  • Variable declaration and printing
  • Arithmetic operations
  • File handling

Symantics

  • $ (dollar sign) followed by a name, such as $name, represents a variable.
  • Text in quotes, such as "name", represents strings.
  • Whereas text without quotes or dollar sign is considered a number and is written as it is.

Unless the type is specifically mentioned in the placeholder text of input fields, the above conventions have to be kept in mind when entering data.

If specifically mentioned in the input fields as to what is required, then only the value shall be written and the symantics will be taken care of by the program.

How to run

This repository shall be cloned into the htdocs folder of XAMMP or the www folder of WAMP. After that, go to localhost on your webbrowser and run the program.

GUI

The toolbar is at the top which contains all the draggable components of the code. The components are to be dragged into the left pane of the window. The right side contains areas for PHP code and PHP output.

image

  • A simple program that shows the functionality of print, conditional and function blocks. This program takes two numbers as input and gives the maximum number as output:

Untitled

  • This sample program shows the function of loops and arithmetic operations, as well as variable declaration.

image

  • This sample program shows basic file handling:

image