GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Logisec/Lua-Bytecode-Parser: A Lua Bytecode Parser written entirely in C++.

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
Parser
Parser
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Parser.sln
Parser.sln
 
 
readme.md
readme.md
 
 

Repository files navigation

Lua Bytecode Parser

This is a basic lua 5.1 bytecode parser written C++.
Usage:
Open the solution file in visual studio make sure you're building with C++17.

Parser.exe <file> (luac file)
Example:
-- This is to demonstrate the parser's ability to parse multiple nested prototypes.
(function()
	print("Hello, World!");

	(function()
		print(1);
	end)();
end)();
Output:
-- Header Info --
Signature: 'Lua'
Version: 81
Format: 0
Endianness: Big Endian
Int Size: 4
Size_t Size: 4
Instruction Size: 4
Lua Number Size: 8
Integral Flag: 0
function main(...)
    -- Prototype Info --
    Source = '@test.lua'
    LineDefined = 0
    LastLineDefined = 0
    NumUpvalues = 0
    NumParameters = 0
    IsVararg = true
    MaxStackSize = 2
    -- Constants --
    -- Instructions --
    Opcode: 36, A: 0, B: 0, C: 0, Mnemonic: CLOSURE
    Opcode: 28, A: 3, B: 1, C: 2, Mnemonic: CALL
    Opcode: 30, A: 2, B: 1, C: 1, Mnemonic: RETURN
    -- Nested Prototypes --
    function proto_000001D6127E6B50(...)
        -- Prototype Info --
        Source = '(none)'
        LineDefined = 1
        LastLineDefined = 1
        NumUpvalues = 0
        NumParameters = 0
        IsVararg = false
        MaxStackSize = 2
        -- Constants --
        [Constant] Type = String, Value = "print"
        [Constant] Type = String, Value = "Hello, World!"
        -- Instructions --
        Opcode: 5, A: 0, B: 0, C: 0, Mnemonic: GETGLOBAL
        Opcode: 1, A: 2, B: 1, C: 0, Mnemonic: LOADK
        Opcode: 28, A: 5, B: 2, C: 3, Mnemonic: CALL
        Opcode: 36, A: 0, B: 0, C: 0, Mnemonic: CLOSURE
        Opcode: 28, A: 3, B: 1, C: 2, Mnemonic: CALL
        Opcode: 30, A: 2, B: 1, C: 1, Mnemonic: RETURN
        -- Nested Prototypes --
        function proto_000001D6127E8F30(...)
            -- Prototype Info --
            Source = '(none)'
            LineDefined = 1
            LastLineDefined = 1
            NumUpvalues = 0
            NumParameters = 0
            IsVararg = false
            MaxStackSize = 2
            -- Constants --
            [Constant] Type = String, Value = "print"
            [Constant] Type = Number, Value = 1
            -- Instructions --
            Opcode: 5, A: 0, B: 0, C: 0, Mnemonic: GETGLOBAL
            Opcode: 1, A: 2, B: 1, C: 0, Mnemonic: LOADK
            Opcode: 28, A: 5, B: 2, C: 3, Mnemonic: CALL
            Opcode: 30, A: 2, B: 1, C: 1, Mnemonic: RETURN
        end
    end
end
We output it in a lua like format. We got the idea from luac.nl.
Anyways, we plan to release a more dynamic version which will handle each and every Lua version.
See anything that could be improved on? Let us know! Logisec Contact Us
Creds:
  • Lua 5.1 Bytecode Reference
  • Lua 5.1 lopcodes.h
  • Luac.nl

About

A Lua Bytecode Parser written entirely in C++.

Topics

bytecodebytecode-parserlualua-bytecodelua-bytecode-parserlua-parserparser

Resources

Readme
GPL-3.0 license
Activity
Custom properties

Stars

9 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.