Skip to content

CineDeveloper/cine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cine - compiler for cine programming language.
In order to start working with the cine language, you need to follow the link and follow the instructions to install cine and fei. Currently available only for Linux x86_64.

Here is an example of creating a simple cine application.

Create the folder named "line".
Open a terminal in the created folder.
Run the following command in the terminal:
fei new line-cine

In the folder you created, several files and folders will appear. Open the main.cine file and delete it's contents. Write the following code in the open file (indentation should consist only of spaces, the number of which should be a multiple of 4):

type Point(a)
    x, y a

type Line(a) a, b a

func getLength(line) rules final = line == Line(_) & line[0][0] > BasicFloat result = line[0][0] deltaX .= line.a.x - line.b.x deltaY .= line.a.y - line.b.y result = (deltaX * deltaX + deltaY * deltaY).sqrt()

func getCoordinateFromSTDIN(coordinateType) rules final = coordinateType > BasicFloat result = coordinateType for lineFromSTDIN .= getLineFromSTDIN() if lineFromSTDIN == "" then exit() if xBox .= #coordinateType.fromString(lineFromSTDIN); xBox.item?() then result = xBox[] break else print(lineFromSTDIN, " - is not a valid float number. Please try again:\n")

proc main() for line := Line(Point(Double)) print("Enter the coordinates of the points (press enter to exit):\n") print(" The x coordinate of the first point:\n") line:a:x = Double.getCoordinateFromSTDIN() print(" The y coordinate of the first point:\n") line:a:y = Double.getCoordinateFromSTDIN() print(" The x coordinate of the second point:\n") line:b:x = Double.getCoordinateFromSTDIN() print(" The y coordinate of the second point:\n") line:b:y = Double.getCoordinateFromSTDIN() printLn("line length - ", line.getLength())

Return to the terminal and execute the following commands in turn:
fei build
sudo fei install pkgs/release.fpkg

To start the program, execute in the terminal:
line-cine

To remove the program, execute in the terminal:
sudo rm -f /usr/bin/line-cine

IMPORTANT!!! If you remove the program, do it very carefully. Since the r and f keys are near and if you accidentally type -rf instead of -f and accidentally put a space after bin, the command will ruin the system.

About

The project is closed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages