https://github.com/cqfn/eo Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} cqfn / eo * Notifications * Star 522 * Fork 54 EOLANG, an Experimental Object-Oriented Programming Language Based on -Calculus www.eolang.org MIT License 522 stars 54 forks Star Notifications * Code * Issues 20 * Pull requests 3 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 28 branches 37 tags Code * Clone HTTPS GitHub CLI [https://github.com/c] Use Git or checkout with SVN using the web URL. [gh repo clone cqfn/e] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @yegor256 yegor256 Merge pull request #298 from SimonHarmonicMinor/feature/#296 -include-... ... 2cd606b Sep 4, 2021 Merge pull request #298 from SimonHarmonicMinor/feature/#296 -include-... ...maven-wrapper Feature/#296 include maven wrapper 2cd606b Git stats * 819 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows #319 make pdf Aug 24, 2021 .mvn Merge pull request #298 from SimonHarmonicMinor/feature/#296 -include-... Sep 4, 2021 eo-maven-plugin #323 resolve works through unpack Sep 3, 2021 eo-parser #316 type for error Aug 7, 2021 eo-runtime #286 fixed Jul 14, 2021 paper chinese Sep 2, 2021 sandbox new dependency model for the hse transcompiler Aug 27, 2021 .0pdd.yml 0pdd config Jan 29, 2018 .gitattributes #58: skeleton Dec 2, 2016 .gitignore #296 added '.mvn/wrapper/maven-wrapper.jar' to .gitignore Jun 14, 2021 .pdd #86 rultor config Dec 15, 2016 .rultor.yml #316 version Aug 6, 2021 .travis.yml openjdk8 Dec 12, 2019 LICENSE.txt year up Jan 14, 2021 README.md Merge pull request #298 from SimonHarmonicMinor/feature/#296 -include-... Sep 4, 2021 mvnw #296 added Maven wrapper Jun 14, 2021 mvnw.cmd #296 added Maven wrapper Jun 14, 2021 pom.xml #317 new parent Aug 19, 2021 View code Quick Start Tutorial How it Works? How to Contribute README.md [6874747073] EO principles respected here Managed by Zerocracy DevOps By Rultor.com We recommend IntelliJ IDEA mvn PDD status Maintainability Maven Central codecov Hits-of-Code Lines of code License FOSSA Status EO (stands for Elegant Objects or ISO 639-1 code of Esperanto) is an object-oriented programming language. 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. EO is based on -calculus (if you want to see its description, join this Telegram chat: @polystat_org). 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 scope (why?) * type casting (why?) * reflection * scalar types and data primitives * annotations (why?) * unchecked exceptions (why?) * operators * flow control statements (for, while, if, etc) * DSL and syntactic sugar (why?) There are products that use EO or -calculus (if you want yours to be in the list, submit a pull request): * polystat is a static analyzer of EO programs * eo2py is a translator of EO to Python * try-phi is an online interpreter of -calculus expressions 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): [...] org.eolang eo-maven-plugin parse optimize compile org.codehaus.mojo exec-maven-plugin test java org.eolang.phi.Main main 2008 org.eolang eo-runtime 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: $ ./mvnw clean install -Pqulice You will need Maven 3.3+ and Java 8+. About EOLANG, an Experimental Object-Oriented Programming Language Based on -Calculus www.eolang.org Topics java language programming-language oop eolang Resources Readme License MIT License Releases 37 don't compile if XML files already present Latest Sep 2, 2021 + 36 releases Used by 14 * @yegor256 * @HSE-Eolang * @HSE-Eolang * @kreofil * @yegor256 * @jesperolsson-se * @hadiSaleh * @HSE-Eolang + 6 Contributors 23 * @yegor256 * @nlchar * @rultor * @g4s8 * @pchmielowski * @nqafield * @alex-semenyuk * @IngeniariusSoftware * @nikololiahim * @SimonHarmonicMinor * @stain + 12 contributors Languages * Java 55.0% * TeX 26.1% * XSLT 18.1% * ANTLR 0.5% * Groovy 0.3% * Shell 0.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.