Coder Social home page Coder Social logo

rnpkr / oberon-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rochus-keller/oberon

0.0 0.0 0.0 11.7 MB

Oberon parser, code model & browser, compiler and IDE with debugger

License: GNU General Public License v2.0

C++ 94.59% QMake 1.02% Lua 1.51% Modula-2 0.96% C 0.12% C# 1.81%

oberon-1's Introduction

Welcome to the Oberon+ parser, code model, compiler and IDE

This project started out as an Oberon-07 parser, code model and transpiler written in C++ and Qt, with the goal to build tools to better understand the Lola-2 compiler and to automatically translate it to maintainable C++ with minimal dependencies to other C++ libraries, and with no dependencies to the Oberon System (see the Lola and LolaCreator repositories).

Oberon turned out to be a language very well suited for compiler front and backend experiments because it is decently simple but still powerful enough to build real-world software, as it supports pointers, static and stack based data structures and call by reference, which are not usually available with scripting languages. In consequence, an other goal of this project is to study the feasibility of reusing LuaJIT as a backend for statically typed programming languages like Oberon (see this article). The current implementation of the compiler is able to map full Oberon+ to LuaJIT and CIL/ECMA-335 bytecode and run with decent performance (see Linux report and Windows report). There is also a compatible version of the Oberon System, as well as a powerful IDE with semantic navigation and source-level debugging (see below).

During my work with Oberon and systems implemented in Oberon, I kept asking myself what properties the language would need to have so that I could use it for my own systems too, without giving up the goal of making it as simple as possible. From these considerations a new language emerged, which I call Oberon+ (i.e. "Oberon with extensions", abbreviated OBX); it is a general-purpose, procedural and object-oriented programming language in the tradition of and based on Oberon-07, Oberon-2 and Oberon 90, with all the elements of these languages, plus generic modules, enumerations, and many additional simplifications such as support for lower case keywords, optional semicolons, and flexible declaration sequences. See the language report and the dedicated language site for more information. The compiler supports both, Oberon+ as well as most of the syntax and semantics of the previous Oberon versions.

For representative examples of Oberon+ see the Are-we-fast-yet benchmark suite migrated to Oberon+. It also demonstrates generic programming with collections and iterators.

What this repository includes

  • The old Oberon-07 validating parser with code model, Lua source code transpiler, C++ transpiler and LuaJIT bytecode compiler (file prefix Ob)
  • The old OberonViewer, Oberon-07 IDE and OBNLC command line version of the compiler/transpiler
  • The Oberon+ LL(1) EBNF grammar
  • The new Oberon+ validating parser, code model, and LuaJIT and CIL/ECMA-335 bytecode compiler (file prefix Obx)
  • The new Oberon+ IDE (a separate one for LuaJIT and Mono), OBXLJ (LuaJIT) and OBXMC (Mono) command line version of the compiler
  • The Oberon+ version of the "Are we fast yet" and "Hennessy" benchmark suites

Planned or work-in-progress features

  • Oberon+ validating parser
  • IDE with semantic navigation & source-level debugger
  • LuaJIT compiler backend
  • Complete built-in procedure and Oakwood library implementations
  • Write documentation and focus articles
  • Implement a CIL/ECMA-335 compiler backend (done for both IL and direct assembly generator)
  • Use a minimal Mono runtime as an alternative to the LuaJIT VM
  • Implement an LLVM compiler backend
  • Foreign Function Interface (FFI, see here for an example))
  • Proceed with the programming language development (based on actual need and after careful consideration)

The Oberon+ IDE

This is a lean IDE (separate for LuaJIT and Mono) with the following features:

  • Full support of the new Oberon+ programming language
  • Syntax highlighting
  • Semantic code navigation; jump to the declaration of an ident (CTRL+click on the ident)
  • Mark all idents refering to the same declaration
  • Cross-reference view: list all instances of an identifier for easy navigation
  • Module view: shows the records declared in the module and their bound procedures together
  • Hierarchy view: shows the inheritance relation of a selected record or the overrides of a selected bound procedure
  • Browsing history, forward and backward navigation
  • Project files combine modules into a single project and associate them with virtual import paths
  • Built-in LuaJIT or Mono engine
  • Bytecode view (LuaJIT or IL assembler syntax), synchronized to source
  • Integrated source level debugger with breakpoints, stack trace and locals view
  • Built-in optional Oakwood or Oberon System backend library

Oberon+ IDE Screenshot

Oberon+ to LuaJIT bytecode compiler

  • Generates LuaJIT 2.0 compatible bytecode
  • The full Oberon+ language including the Oakwood libraries are supported
  • The SYSTEM module is not supported
  • The TRAP() and TRAPIF(condition:BOOLEAN) bult-in procedures let you escape to the debugger
  • FFI with dedicated Oberon+ language constructs for C library integration

Oberon+ to CIL/ECMA-335 assembly and IL compiler

  • Generates either IL assembly language or assembly binaries compatible with ECMA-335/ISO 23271:2012
  • The generated code runs on Mono, .NET and CoreCLR (all supported platforms)
  • Optionally generates Mono debug symbol (MDB) files
  • The full Oberon+ language including generics and the Oakwood libraries are supported
  • The SYSTEM module is not supported (and not necessary)
  • FFI with dedicated Oberon+ language constructs for C library integration

Binary versions

Here is a binary version of the Oberon+ IDE for Windows: http://software.rochus-keller.ch/OberonIDE_win32.zip. Just unpack the ZIP somewhere on your drive and double-click either ObxIDE_Mono.exe or ObxIDE_LuaJIT; Qt libraries are included, as well as the OBXLJ and OBXMC command line tools, the demo Oberon System and some other example projects (open the project using CTRL+O and then run it using CTRL+R, or right-click to open context menus and select the commands from there).

Here is a version of the Oberon+ IDE (Mono) for Linux x86: http://software.rochus-keller.ch/OberonIDE_linux_i386.tar.gz. Qt 5.4.2 is statically linked with the executables. OBXMC, Mono3 and examples are included as well.

Here is the old version of the Oberon+ IDE (LuaJIT) for Linux x86: http://software.rochus-keller.ch/OberonIDE_LuaJIT_linux_i386.tar.gz. It requires a preinstalled Qt version >= 5.4.

Here is a version of the Oberon IDE (Mono) for macOS x86_64 (>= El Capitan): http://software.rochus-keller.ch/OberonIDE_macOS_x64.dmg. The app can just be moved to the drive or used directly from the mounted DMG; everything required is included, also the Oberon System demo; please note that the CTRL key is mapped to the command key on Mac, but you have to press CTRL+mouse key to trigger the right mouse button; to summarize: just click=left click, command+click=middle click, CTRL+click=right click; note that the shortcuts can differ between platforms.

Hier is the old version of the Oberon IDE (LuaJIT) for macOS x86_64: http://software.rochus-keller.ch/OberonIDE_LuaJIT_macOS_x64.dmg.

Here is a binary version of the old OberonViewer for Windows: http://software.rochus-keller.ch/OberonViewer_win32.zip Just download, unpack and run it; no installer is needed. The ZIP includes the needed Qt libraries.

Here is a binary version of the old OberonViewer for Linux x86: http://software.rochus-keller.ch/OberonViewer_linux_x86.tar.gz It requires a preinstalled Qt version >= 5.4.

Build Steps

Follow these steps if you want to build e.g. the Oberon+ IDE yourself:

  1. Make sure a Qt 5.x (libraries and headers) version compatible with your C++ compiler is installed on your system.
  2. Create an empty directory, call it e.g. Build.
  3. Download https://github.com/rochus-keller/GuiTools/archive/master.zip and unpack to in the Build directory. Rename it to GuiTools.
  4. Download https://github.com/rochus-keller/LjTools/archive/master.zip and unpack it to the Build directory. Rename it to LjTools.
  5. Download https://github.com/rochus-keller/LuaJIT/archive/LjTools.zip and unpack it to the Build directory. Rename it to LuaJIT. Go to the src subdirectory and run the build script appropriate to your platform (see LuaJIT/doc/install.html for more information).
  6. Download https://github.com/rochus-keller/MonoTools/archive/refs/heads/master.zip and unpack it to the Build directory. Rename it to MonoTools.
  7. Download https://github.com/rochus-keller/PeLib/archive/refs/heads/OBX.zip and unpack it to the Build directory. Rename it to PeLib.
  8. Download https://github.com/rochus-keller/Oberon/archive/master.zip and unpack it to the Build directory. Rename it to Oberon.
  9. Goto the Build/Oberon directory and execute e.g. QTDIR/bin/qmake ObxIde2.pro (see the Qt documentation concerning QTDIR).
  10. Run make; after a couple of seconds you will find the executable in the build directory.

Alternatively you can open ObxIde2.pro or any other included .pro file using QtCreator and build it there.

Support

If you need support or would like to post issues or feature requests please use the Github issue list at https://github.com/rochus-keller/Oberon/issues or send an email to the author.

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.