Giter Site home page Giter Site logo

jucimarjr / ooerlang Goto Github PK

View Code? Open in Web Editor NEW
4.0 6.0 1.0 4.54 MB

ooErlang is an object oriented extension to the Erlang programming language. Objects are introduced with a syntax close to Java, making easier its adoption by object-oriented programmers.

License: MIT License

Erlang 51.45% Elixir 1.13% Java 42.30% Python 1.47% Ruby 1.25% Scala 1.58% Shell 0.82%

ooerlang's Introduction

ooErlang

https://sites.google.com/site/ooerlang1/

What is this?

ooErlang is an object oriented extension to the Erlang programming language. Objects are introduced with a syntax close to Java, making easier its adoption by object-oriented programmers.

How to Install?

  1. get the source
  2. build
$ cd $OOERLANG_SOURCE_DIR
$ make
  1. configure PATH
# in .bashrc add:
export OOE_HOME=<PATH_TO_OOERLANG_DIR>
export PATH=$PATH:$OOE_HOME

Requirements

  • Erlang and Make

Getting Start

% simple_calculator.cerl
-class(simple_calculator).
-constructor([new/1]).
-export([add/1, sub/1, mult/1, divi/1, clear/0, result/0]).
-export([usage_example/0]).

attributes.
Result = 0.

methods.
new(Value) -> self::Result = Value.

add(Value) -> self::Result = self::Result + Value.
sub(Value) -> self::Result = self::Result - Value.
mult(Value) -> self::Result = self::Result * Value.
divi(Value) -> self::Result = self::Result / Value.

clear() -> self::Result = 0.
result() -> self::Result.

class_methods.
% example of ((2 + 3 - 1) * 3) / 4 = 3
usage_example() ->
    Calculator = simple_calculator::new(2),
    Calculator::add(3),
    Calculator::sub(1),
    Calculator::mult(3),
    Calculator::divi(4),
    Calculator::result().

Build using Erlang Shell

$ erl -pa $(OOE_HOME)/ebin
Eshell v6.0 (abort with ^G)
1> ooec:compile(["simple_calculator.cerl"]).

[{ok, simple_calculator}]
2> simple_calculator:usage_example().
3.0

ooerlang's People

Contributors

williambelleza avatar julianafigueira avatar jucimarjr avatar miliox avatar filipevarjao avatar danielhba avatar

Stargazers

Leonardo Rossi avatar 公子襄 avatar Christoph Grabo avatar Ricardo Pinto avatar

Watchers

 avatar  avatar James Cloos avatar  avatar  avatar  avatar

Forkers

filipevarjao

ooerlang's Issues

Function guard not working

Try to compile a function that has a guard is not working in ooerlang, occurs a badmatch during compilation.

urn and urnc not working

trying to compile a *.cerl file using urnc not work throwing an exception:
(no error logger present) error: "Error in process <0.0.0> with exit value: {function_clause,[{init,prepare_run_args,[{eval,[<<53 bytes>>,<<40 bytes>>]}],[{file,"init.erl"},{line,175}]},{init,map,2,[{file,"init.erl"},{line,203}]},{init,boot,1,[{file,"init.erl"},{line,171}]}]}\n"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.