Skip to content

Iterkocze-Company/ippCompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ippCompiler

ipp Language Compiler. ipp is a cross-platform language that is compiled to c++.

  "i made it, and it work" 
                    ~Michał 2021
To use the compiler, you need to have g++ in your PATH.
Do not use blank spaces in code, use tabs instead.
Actually using i++ and have a question? Contact me: EmDeeTee#6255

Instructions in i++

Echo "hello" Lub EchoLine "hello" Displays string in console window. You can use ~ operator to concatenate two or more strings.

ReadKey Halt program and wait for user input. Returns ASCII value of inputed char.

ReadString Halt program and wait for user input. Returns inputed string. Since i++ is compiled to C++, this code is not legal in i++: string s = ReadString;.

Wait 'int millisecond' ex. Wait 2000 Halts program for 2 seconds.

return Returns value from function. ex. return 4;.

if and else work in the same way as in C++. ex. if x == 1;. To end if block, Use end.

if x == 1;
  EchoLine x; 
end; 
else; 
  EchoLine "else"; 
end;

for ex. for int i = 1; i < 10; i++;.
while ex. while 1==1;.
DoWhile ex.

DoWhile 1==1;
 EchoLine "Helo";
end;

File handling in i++

File To create file object. ex. File myFile;.
File.Open To open a file. ex. myFile.Open "file.txt";.
File.Write Write to file. ex. myFile.Write "text";.
File.Close Close file. ex. myFile.Close;.
CreateFile 'FileName'. ex. CreateFile file; Will create file.txt
File.ReadByLine 'string output' or File.ReadByLineEcho To read file content. ex. myFile.ReadByLine str;. File.ReadByLine and File.ReadBylineEcho are loops, so they need to be ended with end;.

Stuff

Read specific character from string:

string s = "text";
EchoLine s[0];

Operators in i++

~ Concatenate operator. You can use it in Echo or EchoLine, to merge strings.

= Use it to assign value to a variable. ex. int hello = 123;. After using = add one ( )/blank space after variable name.

Arithmetic operators in i++

Use in Echo or EchoLine. ex. EchoLine x*2;

+ Addition
- subtraction
~ Concatenate. ex. EchoLine "Hello" ~ " World";
* Multiplication
/ Division
% Modulo

Outside of Echo or EchoLine ex. x++;

++ Increment
* Multiplication
/ Division

Types in i++

int/int*
string ex. string s; or string s = "hello";.
char
float
double
void In function definitions. ex. def void test();.

Pointers in i++

You can use the address of a variable like this:

int i = 10;
EchoLine i.Address;

Or assign it to a pointer like this:

int i = 10;
int* p = i.Address;

EchoLine p;

Functions in i++

Use def, in order to define a function. After def keyword provide return type. ex. def int test();. End function definition with end keyword. ex.

def void test();
  EchoLine "Function!";
end;

Adding other .ipp

In order to add other, existing .ipp file Use use keyword. ex.

use "code.ipp";

def int main();
  FromDiffrentFile();
end;

Functions can take arguments. ex. def int test(int x, int y);.

Compiler Flags

name=example Change compiled .exe filename to 'example'.
run Run program after compilation.
linux Use this flag, if you are using ippCompiler in Linux.
force Use this flag to force compile program regardless of errors detected by ippCompiler.
macros Downloads additional files needed by ippCompiler.
nogencode Compiler outputs only runable file whitout generated .cpp file.
noout Produces no output. Used in compiling examples.
help Shows list of all compiler flags.
ex: name=hello, run, force

You can use ippCompiler from command line too. ex. ippCompiler.exe code.ipp run or ippCompiler.exe code.ipp -run

Macros

bool MacroContains(string s1, string s2) Returns true, is s1 contains s2, otherwise false.

Hello World in i++

Every i++ program needs to have main function defined. Use def int main();.

def int main();
  EchoLine "Hello, World!";
end;

Function calling example:

def void test(); 
  EchoLine "Function"; 
end; 

def int main(); 
  test(); 
end;

About

ipp Language Compiler. ipp is a cross-platform language that is compiled to c++.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •