Coder Social home page Coder Social logo

oberon-scala-1's Introduction

Oberon Language

This is an implementation of the Oberon language in Scala.

Compiling and Testing

  • Compiling
$ sbt compile

[...]

[info] Loading global plugins from /Users/rbonifacio/.sbt/1.0/plugins
[info] Loading settings for project oberon-scala-build from assembly.sbt,sbt-antlr4.sbt,plugins.sbt ...
[info] Loading project definition from /Users/rbonifacio/Documents/workspace-scala/Oberon-Scala/project
[info] Loading settings for project oberon-scala from build.sbt ...
[info] Set current project to oberon-lang (in build file:/Users/rbonifacio/Documents/workspace-scala/Oberon-Scala/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 1 s, completed 25/08/2021 14:34:33
  • Executing the test cases
$ sbt test

[...]

[info] Run completed in 2 seconds, 286 milliseconds.
[info] Total number of tests run: 246
[info] Suites: completed 14, aborted 0
[info] Tests: succeeded 246, failed 0, canceled 0, ignored 62, pending 0
[info] All tests passed.
[success] Total time: 4 s, completed 25/08/2021 14:36:21

You can also try a combination of the above commands, for instance sbt compile test. It is also possible to run sbt in a "shell" mode (this might save compilation and building time). To start the sbt shell model, just type sbt in a terminal.

$ sbt
[info] Loading global plugins from /Users/rbonifacio/.sbt/1.0/plugins
[info] Loading settings for project oberon-scala-build from assembly.sbt,sbt-antlr4.sbt,plugins.sbt ...
[info] Loading project definition from /Users/rbonifacio/Documents/workspace-scala/Oberon-Scala/project
[info] Loading settings for project oberon-scala from build.sbt ...
[info] Set current project to oberon-lang (in build file:/Users/rbonifacio/Documents/workspace-scala/Oberon-Scala/)
[info] sbt server started at local:///Users/rbonifacio/.sbt/1.0/server/5b1186f4048efb7df7ec/sock

sbt:oberon-lang> 

You can now execute sbt commands directly. See some examples bellow.

sbt:oberon-lang> compile

[success] Total time: 1 s, completed 25/08/2021 14:44:10

sbt:oberon-lang> test

[...]

[info] Run completed in 1 second, 604 milliseconds.
[info] Total number of tests run: 246
[info] Suites: completed 14, aborted 0
[info] Tests: succeeded 246, failed 0, canceled 0, ignored 62, pending 0
[info] All tests passed.
[success] Total time: 3 s, completed 25/08/2021 14:44:41

sbt:oberon-lang>

Building an executable JAR file

In order to generate an executable JAR file, you can run the sbt assembly command.

$ sbt assembly

[...]
[info] Run completed in 1 second, 781 milliseconds.
[info] Total number of tests run: 246
[info] Suites: completed 14, aborted 0
[info] Tests: succeeded 246, failed 0, canceled 0, ignored 62, pending 0
[info] All tests passed.

[info] Assembly up to date: .../target/scala-2.13/oberon-lang-assembly-0.1.1.jar
[success] Total time: 5 s, completed 25/08/2021 14:45:56

This command generates the oberon-lang-assembly-0.1.1.jar artifact into the target/scala-2.13/ folder. You can execute thisartifact using the following command, which prints some usage help of our implementation.

$ cd target/scala-2.13
$ java -jar oberon-lang-assembly-0.1.1.jar --help

Oberon-LLVM

Resources

The following tutorial was very useful in the development of the project: My First Language Frontend with LLVM Tutorial

Missing Features

  • All types besides integers

  • Global Variables

  • For Loops besides "FOR"

Usage

  • Compile the main.cpp program by running the compile.sh file.

  • Move a .oberon file into the directory and rename it "code.oberon".

  • Export the program's AST into a file named "code.json" by running the following command:

java -jar oberon.jar -i code.oberon -o code.json -b json

The oberon.jar file is obtained by compiling the Oberon-Scala project

  • Run the "main" executable to generate the "code.ll" file.

  • Run the genexec.sh to generate the "app" executable.

oberon-scala-1's People

Contributors

rbonifacio avatar xdalle avatar marcelojunqueiraf avatar sergioalonsojr avatar kdusousa avatar cezari0o avatar leoriether avatar eduardocserra avatar rafaelcn avatar alexandreps1123 avatar rayxan avatar ziul123 avatar ronaldcdo avatar delanoerhardt avatar alvimpaulo avatar brun8 avatar dudufreire avatar brunovarg avatar vinis-caixe avatar hrrocha0 avatar masathayde avatar cadu-or avatar caio546 avatar trajano7 avatar clararabello avatar oestradiol avatar mrholyveira avatar matheussiade avatar oszoto avatar victorlisboa avatar

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.