A spell compiler implemented by Ducky Peripherals [HC] Minecraft Game

Original code

The first code is retained to retain the thinking distance

The design idea is to analyze it by line, and only one code syntax is processed in each line, so one line is not allowed to write multiple keywords.

like:

 me#correct grammar

me me#not allowed

There are two files, one is IOTA2STR. The function is to read the core pattern in the FOCAL_PORT in Ducky Peripherals Mod, which is read and converted into a string in the lua table format to use it in another file to use

Another file is hexcompiler. The hexmap is the mapping table of the keyword to the pattern. It needs to bring a parameter, and the parameter is the file name you want to compile.Output IOTA

Source code file one by one command

The HexMap currently provided is not a perfect version. It is best to set the specific mapping table by themselves. Each person's language habits are different, so only part of the mapping is provided for reference

ota2Str -Pastebin.com

hex compiler -pastebin.com

Source_code:

 {{

me

POS

me

sign

me

me

me

POS

{{

{{

Unpack

}

}

}

output:

Non -fixed pattern generation version

Subsequent versions of the pattern that generates digital patterns and remove the specified elements of the stack, provides two versions. In addition to digital patterns, the code is consistent. The syntax matching and switching is a regular expression, which can be expanded freely.

Remove the specified stack element grammar definition:

 RM position 

For details, please refer to the reference code

hexcompiler_multipatter- pastebin.com:

Each one of the decimal penetration through the stack type is generated to generate the calculation pattern list.

hexcompiler_infinitytri -Pastebin.com:

Because Ducky Peripherals allows a overlapping pattern, there is this version. The digital constant is implemented by a pattern by directly overlapping painting. The length of the pattern list is 1

Reference code:

 {{

me

RM 1

me

sign

{{

0

12

456

}

RM 2

}

Add package, function and annotation function

Annotation

The annotation can be a whole line notes, or the annotation is behind the code line. The keyword is #

Note code:

#this is a comment

get_SightCastBlock ()#get the sign,

DIG#DIG POS BLOCK

function

The function function is added. The function is defined in the file. There is no parameter, and it is more similar to the macro definition replacement.The definition function starts with the @Func function name, ends at @End, and when calls, use the function name to add brackets: function name () to implement function calls.If you want to call a function, you need to ensure that the definition of the function is before calling.

@Func Get_sightCastBlock

Me

POS

Me

Sign

Get_block

@End

get_SightCastBlock ()

Bag

For consideration of the reuse function, a package is provided.The package is a collection of functions. It is a special file. Compared with ordinary files, there is only function definition. There are no other ordinary code. A code that does not allow appears outside the function body in a file, otherwise it will be abnormal.Use the @include file path keyword to import the package.

A demonstration is provided here to write the function in Tools, but call the function in TST.

Tools:

@Func Get_sightCastBlock

Me

POS

Me

Sign

Get_block

@End

tst:

@include Tools

get_SightCastBlock ()

Output:

Source code: hexcompiler -pastebin.com

Some tools

In order to better edit instantly in the game, make two tools, and put forward the common form in the previous compiler file as a separate file, which is also for more convenient modification.However, the hexmap table needs to be edited and improved in the HexMap file. The two tools provided below depend on the hexmap mapping table in the HexMap file

hex.lua -pastebin.com

hexmap- pastebin.com

Code editor

Hedit is a modification of my EDIT that comes with CC to achieve the keywords corresponding to automatic syntax completion when editing. The use of Edit is the same as Edit, but Run is replaced by me to compile.For peripherals, the compile option will be displayed, which will compile the current file into iOTA into Focal_PORT.

hedit.lua -pastebin.com

Auxiliary tool

IOTATOOLS file is a tool with three functions. The usage method is: IOTATOOLS parameter>

You can perform some convenient operations on the IoTA with a list of patterns in Focal_PORT

The type of command is:

TOSTR: Consistent with the previous IOTA2STR tool, converting the IOTA in Focal_PORT into a string is stored in the data file

DEC: Reverse compilation tool, read IoTA in Focal_port, translate the code format defined by your own HEXMAP mapping, and fill in the angles value instead of the non -existing mapping.In the file, APPEND: Assist the Hexmap tool, read the IoTA in Focal_Port, find the mapping that does not exist in your Hexmap in the IOTA, add the mapping of the corresponding KEY value to the Hexmap tail, and store it in the newhexmap file.If the parameter specifies the OverWrite, the hexmap file will be directly covered. This method supports the pattern list without only a single pattern

IOTATOOLS.LUA -PASTEBIN.com

Label

This startup script is to allow the program to automatically fill the path and command. If it is not running, it cannot automatically match the corresponding program path and parameters. Just save this startup script to startup.lua, or add it to yourself to yourselfThe startup script, if it does not use it, each program can also perform path completion or parameter completion after running once.

hexstartup -pastebin.com

If you want to run normally, the code file except the hexstartup.lua file needs to keep the name consistent with the file name on the Pastebin, or to keep the file name from downloading from github unchanged

Follow -up update

If there is a code update, it will be pushed to github, which is convenient to record the update content

HexcastCompiler- (github)