All Projects → cqfn → Eo

cqfn / Eo

Licence: mit
EOLANG, the Programming Language

Programming Languages

java
68154 projects - #9 most used programming language
language
365 projects

Labels

Projects that are alternatives of or similar to Eo

python-yamlable
A thin wrapper of PyYaml to convert Python objects to YAML and back
Stars: ✭ 28 (-93.67%)
Mutual labels:  oop
metroidvaniafangame
A platformer game designed for the iphone 8-XS, created with an object oriented approach and MVC pattern. Technical details/Credits in README
Stars: ✭ 30 (-93.21%)
Mutual labels:  oop
Laconia
🏺 ‎ A minimalist MVC framework.
Stars: ✭ 307 (-30.54%)
Mutual labels:  oop
BashClass
BashClass is an Object Oriented Programming language that compiles to BASH 4.4
Stars: ✭ 40 (-90.95%)
Mutual labels:  oop
ddd-example-ecommerce
Domain-driven design example in Java with Spring framework
Stars: ✭ 73 (-83.48%)
Mutual labels:  oop
Pmanager
A project management system built using laravel. Watch full video here
Stars: ✭ 260 (-41.18%)
Mutual labels:  oop
alleycat-reactive
A simple Python library to provide an API to implement the Reactive Object Pattern (ROP).
Stars: ✭ 15 (-96.61%)
Mutual labels:  oop
Design Patterns
Contains examples of design patterns that implemented in php
Stars: ✭ 375 (-15.16%)
Mutual labels:  oop
hangman
Hangman (the game)
Stars: ✭ 26 (-94.12%)
Mutual labels:  oop
Stampit
OOP is better with stamps: Composable object factories.
Stars: ✭ 3,021 (+583.48%)
Mutual labels:  oop
OOP-In-CPlusPlus
An Awesome Repository On Object Oriented Programming In C++ Language. Ideal For Computer Science Undergraduates, This Repository Holds All The Resources Created And Used By Me - Code & Theory For One To Master Object Oriented Programming. Filled With Theory Slides, Number Of Programs, Concept-Clearing Projects And Beautifully Explained, Well Doc…
Stars: ✭ 27 (-93.89%)
Mutual labels:  oop
design-patterns-java
📗 Classic OOP Design Patterns from GoF, implemented in Java.
Stars: ✭ 25 (-94.34%)
Mutual labels:  oop
Solid
Книга о принципах объектно-ориентированного дизайна SOLID
Stars: ✭ 280 (-36.65%)
Mutual labels:  oop
teletakes
True Object-Oriented Telegram Bot Framework
Stars: ✭ 18 (-95.93%)
Mutual labels:  oop
Tensorflow Project Template
A best practice for tensorflow project template architecture.
Stars: ✭ 3,466 (+684.16%)
Mutual labels:  oop
ro.py
ro.py is a modern, asynchronous Python 3 wrapper for the Roblox API.
Stars: ✭ 65 (-85.29%)
Mutual labels:  oop
TicariOtomasyon
Mağazaya gelen elektronik eşyalara ait ürün , stok ve satış bilgisinin tutulduğu proje
Stars: ✭ 14 (-96.83%)
Mutual labels:  oop
Designpatternsphp
sample code for several design patterns in PHP 8
Stars: ✭ 20,158 (+4460.63%)
Mutual labels:  oop
Attrs
Python Classes Without Boilerplate
Stars: ✭ 3,786 (+756.56%)
Mutual labels:  oop
Akita
🚀 State Management Tailored-Made for JS Applications
Stars: ✭ 3,338 (+655.2%)
Mutual labels:  oop

Donate via Zerocracy

EO principles respected here Managed by Zerocracy DevOps By Rultor.com We recommend IntelliJ IDEA

Build Status PDD status Maintainability Hits-of-Code License Lines of code Maven Central

EO (stands for Elegant Objects or ISO 639-1 code of Esperanto) is an object-oriented programming language. It's still a prototype. It's the future of OOP. Please contribute! By the way, we're aware of popular semi-OOP languages and we don't think they are good enough, including Java, Ruby, C++, Smalltalk, Python, PHP, C#: all of them have something we don't tolerate.

EO is not planning to become a mainstream language—this is not what we want. Our main goal is to prove to ourselves that true object-oriented programming is practically possible. Not just in books and abstract examples, but in real code that works. That's why EO is being created—to put all that "crazy" pure object-oriented ideas into practice and see whether they can work. It's an experiment, a prototype, a proof-of-concept.

If you want to contribute, please join our Telegram chat first.

Our Twitter tag is #eolang.

These things we don't tolerate:

  • static/class methods or attributes (why?)
  • classes (why?)
  • implementation inheritance (why?)
  • mutability (why?)
  • NULL (why?)
  • global variables/procedures
  • reflection
  • type casting (why?)
  • scalar types and data primitives
  • annotations (why?)
  • unchecked exceptions (why?)
  • operators
  • flow control statements (for, while, if, etc)
  • DSL and syntactic sugar (why?)

We want EO to be compilable to Java. We want to stay as close to Java and JVM as possible, mostly in order to re-use the eco-system and libraries already available.

We also want to have an ability to compile it to any other language, like Python, C/C++, Ruby, C#, etc. In other words, EO must be platform independent.

Quick Start

Here is a simple program that gets a year from command line and tells you whether it's leap or not:

+alias org.eolang.io.stdout

[args...] > main
  [y] > leap
    or. > @
      and.
        eq. (mod. y 4) 0
        not. (eq. (mod. y 100) 0)
      eq. (mod. y 400) 0
  stdout > @
    sprintf
      "%d is %sa leap year!"
      (args.get 0).nextInt > year!
      if (leap year:y) "" "not "

In order to compile this program, put it into src/main/eo/main.eo and then create a file pom.xml with this content (it's just a sample):

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.eolang</groupId>
        <artifactId>eo-maven-plugin</artifactId>
        <version>0.1.10</version>
        <executions>
          <execution>
            <goals>
              <goal>parse</goal>
              <goal>optimize</goal>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <mainClass>org.eolang.phi.Main</mainClass>
          <arguments>
            <argument>main</argument>
            <argument>2008</argument>
          </arguments>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.eolang</groupId>
      <artifactId>eo-runtime</artifactId>
      <version>0.1.10</version>
    </dependency>
  </dependencies>
</project>

Then, you just run mvn clean test (you will need Maven 3.3+) and the .eo file will be parsed to .xml files, transformed to .java files, and then compiled to .class files. You can see them all in the target directory. You will need Java 8+.

More examples are here.

Tutorial

Let's start with a simple EO program:

+alias stdout org.eolang.io.stdout

[] > app
  stdout > @
    "Hello, world!"

Here we create a new abstract object named app, which has got a single attribute named @. The object attached to the attribute @ is a copy of the object stdout with a single argument "Hello, world!". The object stdout is also abstract. It can't be used directly, a copy of it has to be created, with a few requirement arguments provided. This is how a copy of the object stdout is made:

stdout
  "Hello, world!"

The indentation in EO is important, just like in Python. There have to be two spaces in front of the line in order to go to the deeper level of nesting. This code can also be written in a "horizontal" notation:

stdout "Hello, world!"

Moreover, it's possible to use brackets in order to group arguments and avoid ambiguity. For example, instead of using a plain string "Hello, world!" we may want to create a copy of the object stdout with a more complex argument: a copy of the object sprintf:

+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf

[] > app
  stdout > @
    sprintf
      "Hello, %s!"
      "Jeffrey"

Here, the object sprintf is also abstract. It is being copied with two arguments: "Hello, %s!" and "Jeffrey". This program can be written using horizontal notation:

+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf

[] > app
  (stdout (sprintf "Hello, %s!" "Jeffrey")) > @

The special attribute @ denotes an object that is being decorated. In this example, the object app decorates the copy of the object stdout and through this starts to behave like the object stdout: all attributes of stdout become the attributes of the app. The object app may have its own attributes. For example, it's possible to define a new abstract object inside app and use it to build the output string:

+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf

[] > app
  stdout (msg "Jeffrey") > @
  [name] > msg
    sprintf "Hello, %s!" name > @

Now, the object app has two "bound" attributes: @ and msg. The attribute msg has an abstract object attached to it, with a single "free" attribute name.

This is how you iterate:

+package sandbox
+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf

[args...] > app
  memory > x
  seq > @
    x.write 2
    while.
      x.less 6
      [i]
        seq > @
          stdout
            sprintf "%dx%d = %d\n" x x (x.pow 2)
          x.write (x.add 1)

This code will print this:

2 x 2 = 4
3 x 3 = 9
4 x 4 = 16
5 x 5 = 25

Got the idea?

How it Works?

The entire process of turning an .eo program into an executable binary code constists of a few steps, which must be done one after another:

  • Parsing. It's done by the org.eolang.parser.Syntax class in the eo-parser module. It takes the source code in a plain text format and parses into XML document, using ANTLR4 and Xembly. The output of the parser you can find in the target/eo/parse directory.

  • Optimization. There are a number of XSL transformations that need to be done with the XML document in order to make it ready for compilation. Each transformation has its own .xsl file in the eo-parser directory. The class org.eolang.parser.Program is responsible for making XSLT transformations and the entire list of them is stored in the org.eolang.parser.Pack class. Some of XLST files are sanity checks (or linters). The output of each transformation you can find in the target/eo/optimize directory.

  • Compilation. The class org.eolang.maven.CompileMojo in the eo-maven-plugin module is responsible for putting parsing and optimization steps together and then transforming the XML document into a collection of .java files. There are a number of transformations that do this, they all exist in .xsl files. The output of this step you can find in the target/generated-sources directory.

There is also a module called eo-runtime, which includes both .eo and .java code for most popular and important objects that any of you will need in order to write even a simple EO program. There are objects like string, int, sprintf, stdout, and so on. By the way, you may want to contribute there by creating new objects.

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].