Skip to content

Language that provides an abstraction to a PART of GTK difficulty .

Notifications You must be signed in to change notification settings

RedRosh/GPP_COMPILER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to GPP_COMPILER

Language that provides an abstraction to a PART of GTK difficulty .

To get projet on your computer, clone it using the following command :

git clone https://github.com/RedRosh/GPP_COMPILER

Install gtk3 on your ubuntu machine:

sudo apt-get install libgtk-3-dev

To test the compiler, on your terminal, do the following :

1- change directory :

cd GPP_COMPILER

2- Compile the compiler :

make all

3-finally, run your test file:

./gpp test.gpp

How to write a gpp code :

The syntaxe of a gpp file is pretty simple , it contains 4 types of widgets that are :

  • Interface : The root component, a window that contains the other ones.

  • Button : A simple button that you can click.

  • InputField : A field where you can write your input.

  • Label : A place holder in which you can write titles, names ...

The correct way to write the code is such as the following :

WIDGET WIDGET_NAME : {
    PROPERTY : VALUE [,]
    [PROPERTY : VALUE ]
};

Begin
Start INTERFACE_NAME INTERFACE_PROPERTY;
Put WIDGET_NAME X Y ;
[Put WIDGET_NAME X Y ;]
Show INTERFACE_NAME;
End
  • WIDGET : one of the 4 previous types, written in PascalCase.

  • WIDGET_NAME : your variable name which can contain numbers and letters only, and starting with a letter.

  • PROPERTY : can be one of the following :

    • For any widget :

      • Height : is the height of the widget, and has a VALUE of a positive Integer.

      • Width : is the width of the widget, and has a VALUE of a positive Integer.

      • Opacity : is the opacity of the widget, and has a VALUE of a positive Integer between 0 and 100.

        The following properties are for styling purposes :

      FONT PROPERTIES

      • FontSize : is the size of the font, and has an Integer value.
      • FontStyle : is the style of the font, and can take one of the following VALUES : "normal", "oblique", "italic".
      • FontWeight : is the weight of the font, and can take one of the following VALUES : "normal", "bold", "bolder", "lighter".

      COLOR PROPERTIES

      • BackgroundColor : A string that is the bachgroundcolor in hexadecimal. Ex : "#123456"
      • Color : A string that is the widget color in hexadecimal. Ex : "#123456"

      FONT PROPERTIES

      • LetterSpacing : The lenght between letters, take an Integer value.
      • TextDecorationLine : Can be one of these VALUES : "none", "underline", "line-through".
      • TextDecorationStyle : Can be one of these VALUES : "solid", "double", "wavy".

      BOX PROPERTIES

      • MarginTop

      • MarginLeft

      • MarginRight

      • MarginBottom

        The margin lenght in each side, takes an Integer value

      • PaddingTop

      • PaddingLeft

      • PaddingRight

      • PaddingBottom

        The margin lenght in each side, takes an Integer value

      • MinWidth : The minimum value of the widget's width, takes an Integer value.

      • MinHeight : The minimum value of the widget's height, takes an Integer value.

      BORDER PROPERTIES

      • BorderWidth : The width of the border, takes an Integer value
      • BorderRadius : The width of the border, takes an Integer value.
      • BorderStyle : Can be one of these VALUES : "none", "solid", "dotted", "dashed".
      • BorderColor : A string that is the widget's border color in hexadecimal. Ex : "#123456".

      For more informations about styling props, Click here

    • For the Interface widget :

      • Title : is the title of the interface, and has a VALUE of a String.
    • For the Button widget :

      • Text : is the text inside the button, and has a VALUE of a String.
    • For the InputField widget :

      • Text : is the text inside the input field, and has a VALUE of a String.

      • PlaceHolder : is the default appearing text in the input field, and has a VALUE of a String.

      • MaxLength : is the maximum length of the input, and has a VALUE of a positive Integer.

    • For the Label widget :

      • Text : is the text in the label, and has a VALUE of a String.

      • Angle : is the angle in which the text is written, and has a VALUE of an Integer between 0 and 359.

      • Xalign : is the horizontal text alignment, and has a VALUE of a positive Integer.

      • Yalign : is the vertical text alignment, and has a VALUE of a positive Integer.

PS1 : If you want to add more properties to a widget, you need to end your line with a comma ( , ).

  • INTERFACE_NAME : is the name of your predefined Interface variable.

    • INTERFACE_PROPERTY : is the property in which you want your interface to show up. It can be:

      • "CENTER" : if you want your interface to appear in the center of your string.

      • "MOUSE : if you want your interface to appear in the current position of your mouse.

      Note that "CENTER" and "MOUSE" are strings and not keywoards.

  • X : The x position of your widget, it has the value of an Integer.

  • Y : The y position of your widget, it has the value of an Integer.

PS2 : all the keywords are written in PascalCase.

FINAL PRODUCT :

Here's the final result ⭐ ⭐ ⭐ ⭐ ⭐ :

Test Image

TO DO :

  • Lexer
  • Parser
  • Testing the code
  • Semantic
  • Styles
  • Testing the code :

About

Language that provides an abstraction to a PART of GTK difficulty .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages