• Stars
    star
    236
  • Rank 165,893 (Top 4 %)
  • Language
    C++
  • License
    GNU General Publi...
  • Created almost 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

LuaJIT 2.0 bytecode parser, viewer, assembler and test VM. Lua 5.1 parser, IDE and debugger.

About this Project

This is a parser, browser, assembler and test VM for LuaJIT 2.0 bytecode written in C++ and Qt. See http://luajit.org/ for more information about LuaJIT. There is also a validating Lua parser and IDE (see below).

The goal of this project (work in progress) is to better understand how LuaJIT works, and to support the development of alternative front ends which generate LuaJIT bytecode (as it is e.g. done in https://github.com/rochus-keller/Oberon).

The viewer can be used to edit and compile Lua source code and display it side by side with its corresponding LuaJIT bytecode. The test VM implements a subset of LuaJIT bytecodes to study and validate their functions (see the examples subfolder).

Here is a Lua BcViewer screenshot: LjBcViewer Screenshot

The assembler can be used to directly program and test with LuaJIT bytecode. The syntax is defined in LjAsm.ebnf; here is a PDF: http://software.rochus-keller.ch/LjAsm_Syntax.pdf. It slightly abstracts from original LuaJIT bytecode and supports automatic register allocation. Documentation of the syntax is TBD; varargs and for loops are not yet supported (because most likely not used by the new front ends). The editor supports semantic highlighting and navigation (CTRL+Click on ident), and shows a list of cross-references when an ident is selected.

Here is an Asm Editor screenshot: LjAsmEditor Screenshot

Lua parser and IDE features

  • Project file format: combine Lua modules to a single project
  • Implements Lua 5.1; successfully parses all puc-tests
  • Validates syntax and some semantics, reports errors and warnings (e.g. implicit global declaration gives a warning)
  • Automatic re-parse when edited, navigable issue list, marked issues in code
  • Syntax highlighting
  • Code navigation; jump to the declaration of an ident (only for locals)
  • Mark all idents refering to the same declaration
  • Cross-referencing: list all uses of a declaration for easy navigation
  • Browsing history, forward and backward navigation- Project file format: combine modules to a single project
  • Built-in LuaJIT engine
  • Integrated source level debugger with breakpoints, stack trace and locals view
  • A stack trace is also shown if TRAP evaluating to true is executed

Lua IDE Screenshot

LuaJIT bytecode debugger

The bytecode debugger supports single step debugging of LuaJIT bytecode. It can do step-in, step-over and step-out, as well as stop at configurable breakpoints. All features are accessible by GUI. The debugger is embeddable to other applications, currently by SomLjVirtualMachine (see https://github.com/rochus-keller/som/). The debugger depends on commit ccc257a of https://github.com/rochus-keller/LuaJIT/tree/LjTools for the required bytecode program counter resolution. With each break or step the local variables including unnamed temporary registers are displayed as well as the stack trace. You can double-click on the stack levels to change to the corresponding local variable set.

LuaJIT Bytecode Debugger Screenshot

Binary Versions

Here is a precompiled version of LjAsmEditor for Linux i386: http://software.rochus-keller.ch/LjAsmEditor_linux32.tar.gz

Here is a precompiled version of LjBcViewer for Linux i386: http://software.rochus-keller.ch/LjBcViewer_linux32.tar.gz

Both versions require a working Qt 5.x base package and printsupport compatible with i386; LuaJIT is statically linked with the binaries.

Build Steps

Follow these steps if you want to build LjBcViewer yourself:

  1. Make sure a Qt 5.x (libraries and headers) version compatible with your C++ compiler is installed on your system.
  2. A compiled version of LuaJIT 2.0 is also required; your distro likely includes a dev package. Alternatively download the source from http://luajit.org/download/LuaJIT-2.0.5.tar.gz and run the Makefile; make sure the resulting libluajit.so/lib is accessible to the linker.
  3. Create a directory; let's call it BUILD_DIR
  4. Download the source code from https://github.com/rochus-keller/LjTools/archive/master.zip to the BUILD_DIR; rename the subdirectory to "LjTools".
  5. Download the GuiTools source code from https://github.com/rochus-keller/GuiTools/archive/master.zip and unpack it to the BUILD_DIR; rename it to "GuiTools".
  6. Goto the BUILD_DIR/LjTools subdirectory and execute QTDIR/bin/qmake LjBcViewer.pro (see the Qt documentation concerning QTDIR).
  7. Run make; after a couple of seconds you will find the executable in the build directory.

Alternatively you can open LjBcViewer.pro using QtCreator and build it there.

LjAsmEditor.pro is compiled in the same way. The application makes use of a parser generated by Coco/R based on input from EbnfStudio (see https://github.com/rochus-keller/EbnfStudio). There is no other dependency than the Qt Basic library. The repository already contains the generated files. In order to regenerate LjasParser.cpp/h you have to use this version of Coco/R: https://github.com/rochus-keller/Coco.

More Repositories

1

LeanQt

LeanQt is a stripped-down Qt version easy to build from source and to integrate with an application.
C++
512
star
2

Oberon

Oberon parser, code model & browser, compiler and IDE with debugger
C++
336
star
3

Smalltalk

Parser, code model, interpreter and navigable browser for the original Xerox Smalltalk-80 v2 sources and virtual image file
C++
242
star
4

VerilogCreator

VerilogCreator is a QtCreator based IDE for Verilog 2005
C++
153
star
5

LeanCreator

LeanCreator is a stripped-down version of Qt Creator, easy to build from source on all platforms supported by LeanQt and using BUSY instead of qmake.
C++
110
star
6

BUSY

BUSY is a lean, statically typed, cross-platform, easily bootstrappable build system for GCC, CLANG and MSVC inspired by Google GN
C
72
star
7

LisaPascal

A parser and browser for the Lisa source code published by the Computer History Museum
C++
44
star
8

EbnfStudio

EbnfStudio can be used to edit and analyze EBNF grammars.
C++
39
star
9

OberonSystem

Modified version of the original from http://www.projectoberon.com/ for use with the Oberon IDE
C++
35
star
10

Som

Parser, code model, navigable browser and VM for the SOM Smalltalk dialect
C++
19
star
11

QtcVerilog

This is a stand-alone Verilog IDE derived from a QtCreator 3.6.1 subset featuring the VerilogCreator plugin
C++
14
star
12

GnTools

GN meta-build system parser, static code model and navigable code browser
C++
11
star
13

LolaCreator

LolaCreator is a QtCreator based IDE for Lola-2
C++
10
star
14

FlowLine2

FlowLine2 is a modelling tool supporting Functional Analysis and Business Process Modelling
C++
9
star
15

Verilog

This is the Verilog 2005 parser used by VerilogCreator
C++
8
star
16

DoorScope

DoorScope application supporting the specification review process
C++
7
star
17

CARA

Computer Aided Resonance Assignment (CARA)
C++
6
star
18

Lola

This is the Lola-2 parser used by LolaCreator
C++
6
star
19

Udb

This is the NoSql database used by CrossLine and other tools by Rochus
C++
4
star
20

CspChan

A pure C89 implementation of Go channels, including blocking and non-blocking selects.
C
4
star
21

Algol60

A parser and code editor with syntax coloring for Algol 60 written in Qt
C++
4
star
22

Coco

Compiler Generator Coco/R modified for VerilogEbnf
C++
4
star
23

NAF

NMR Application Framework
C++
4
star
24

Mat5

Mat5 is a library and viewer application to read and write MATLAB MAT Level 5 files
C++
3
star
25

PeLib

This is a modified version of https://github.com/LADSoft/DotNetPELib
C++
3
star
26

Lolac

This is the C++ version of Wirth's Lola-2 compiler
C++
3
star
27

Oln2

This is the outliner library used by CrossLine and other tools by Rochus
C++
3
star
28

VerilogEbnf

LL(1) Verilog 2005 EBNF syntax and analysis/generator tool
C++
3
star
29

WorkTree

WorkTree is a project planning and analysis tool supporting the Critical Path (CPM) and the Precedence Diagram Method (PDM)
C++
3
star
30

GuiTools

Some reusable C++ GUI classes, Qt based
C++
3
star
31

Simula

A Simula 67 parser written in C++ and Qt
C++
3
star
32

LuaNLopt

A Lua adapter to the NLopt nonlinear optimization libary (at http://ab-initio.mit.edu/wiki/index.php/NLopt)
C++
2
star
33

C2OBX

C header file to Oberon+ definition module transpiler
C++
2
star
34

BlackboxFramework

This is a modified subset of the Blackbox framework 1.7.2 used to test my Oberon+ parser and validator
2
star
35

DoorScopeETL

DoorScope Extract Transfer Load (ETL) application for data export from DOORS
C++
2
star
36

AdaViewer

Ada lexer and syntax highlighter for Qt
C++
2
star
37

Sdf

This is the Sdf (Standard Delay Format) parser used by VerilogCreator
C++
2
star
38

MonoTools

Mono Debugger Interface and MDB generator for Oberon+ IDE II
C++
2
star
39

TccGen

A reusable compiler backend for the i386, x86_64, ARM and AArch64 architecture based on TCC, with an IR on bytecode level including type and control flow information
C
2
star
40

Qt-5.4.2

This is an unmodified mirror of a subset of http://download.qt.io/archive/qt/5.4/5.4.2
C++
1
star
41

Sdb

This is the NoSql database used by DoorScope
1
star
42

Qt-4.8.7

This is an unmodified mirror of http://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
C++
1
star