Skip to content

Releases: byxor/NeverScript

Pre-release 0.8

09 Apr 13:52
Compare
Choose a tag to compare
Pre-release 0.8 Pre-release
Pre-release

Small stability/usability improvements.

  • Fixed else statement bytecode for THPS4.
  • Renamed command-line argument to -showDecompiledRoq.
  • Added error messages for syntax errors (but not everything is covered yet).
    • e.g. ERROR example.ns(line 5) - Incomplete assignment
  • Added timeout when roq decompiler goes into infinite loop.
  • Added timeout when neverscript compiler goes into infinite loop (due to unforeseen bugs/unimplemented features).
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Release 0.8

Usage of ns:

COMPILATION:
    -c                 (required string)  Specify a file to compile (.ns).
    -o                 (optional string)  Specify the output file name (.qb).
    -targetGame        (optional string)  Specify which game to target (defaults to
 "thug2").
    -removeChecksums   (optional flag)    Removes checksum information from end of
output.
    -showHexDump       (optional flag)    Display the compiled bytecode in hex form
at.
    -showDecompiledRoq (optional flag)    Display output from roq decompiler (roq.e
xe must be in your PATH).

PRE GENERATION:
    -p                 (required string)  Specify a pre spec file (.ps).
    -showHexDump       (optional flag)    Display the pre bytes in hex format.

DECOMPILATION (very incomplete):
    -d                 (required string)  Specify a file to decompile (.qb).
    -o                 (optional string)  Specify the output file name (.ns).
    -showCode          (optional flag)    Display the decompiled code as text.

Pre-release 0.7

31 Mar 22:22
Compare
Choose a tag to compare
Pre-release 0.7 Pre-release
Pre-release
  • Added option to target a specific game.
    • Though I've only tested against thps4 and thug2.
  • Added support for checksum literals:
    • #deadf00d gets compiled as 16 DE AD F0 0D (bytecode).
  • Added support for spaces within checksums:
    • `my variable` = `camo shorts`
  • Added support for escape sequences within strings:
    • one_backslash = "\\"
    • two_backslashes = "\\\\"
    • one_double_quote = "\""
    • two_double_quotes = "\"\""
  • Added option to remove checksum information from output.
  • Fixed bug that prevented checksums from starting with keywords e.g.:
    • script_1
    • oracle
    • andrew_reynolds
    • breakage
  • Fixed game crashes from nested while loops.
  • REMOVED experimental boolean return syntax.
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Release 0.7

Usage of ns:

COMPILATION:
    -c                 (required string)  Specify a file to compile (.ns).
    -o                 (optional string)  Specify the output file name (.qb).
    -targetGame        (optional string)  Specify which game to target (defaults to "thug2").
    -removeChecksums   (optional flag)    Removes checksum information from end of output.
    -showHexDump       (optional flag)    Display the compiled bytecode in hex format.
    -decompileWithRoq  (optional flag)    Display output from roq decompiler (roq.exe must be in your PATH).

PRE GENERATION:
    -p                 (required string)  Specify a pre spec file (.ps).
    -showHexDump       (optional flag)    Display the pre bytes in hex format.

DECOMPILATION (very incomplete):
    -d                 (required string)  Specify a file to decompile (.qb).
    -o                 (optional string)  Specify the output file name (.ns).
    -showCode          (optional flag)    Display the decompiled code as text.

Pre-release 0.6

23 May 03:46
Compare
Choose a tag to compare
Pre-release 0.6 Pre-release
Pre-release

Should probably be a minor release, but I'm too lazy to introduce another number.

Small fixes:

  • -decompileWithRoq flag now uses roq from system path instead of current directory.
  • Running ns shows help/usage screen instead of attempting to use hardcoded arguments.
  • No more inconsistent tabs/spaces in help/usage screen.
  • Parsing array lookups is now more reliable (e.g. (array[0]) doesn't hang the compiler anymore).
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Release 0.6

Usage of ns:

COMPILATION:
    -c                 (required string)  Specify a file to compile (.ns).
    -o                 (optional string)  Specify the output file name (.qb).
    -showHexDump       (optional flag)    Display the compiled bytecode in hex format.
    -decompileWithRoq  (optional flag)    Display output from roq decompiler (roq.exe must be in your PATH).

PRE GENERATION:
    -p                 (required string)  Specify a pre spec file (.ps).
    -showHexDump       (optional flag)    Display the pre bytes in hex format.

DECOMPILATION (very incomplete):
    -d                 (required string)  Specify a file to decompile (.qb).
    -o                 (optional string)  Specify the output file name (.ns).
    -showCode          (optional flag)    Display the decompiled code as text.

Pre-release 0.5

23 Dec 18:27
Compare
Choose a tag to compare
Pre-release 0.5 Pre-release
Pre-release
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Release 0.5

Usage of ns:
  -c string
        Specify a file to compile (.ns).
  -decompileWithRoq
        Display output from roq decompiler (roq.exe must be in your PATH).
  -o string
        Specify the output file name.
  -p string
        Specify a pre spec file (.ps).
  -showHexDump
        Display the output in hex format (e.g. compiled bytecode or raw pre file).

Generating a PRE/PRX file:

You can generate a pre/prx file by providing a pre spec.

$ ns -p myPreSpec.ps -o bundle.pre

This will read the pre spec from myPreSpec.ps and create a new PRE file: bundle.pre

  • Use -showHexDump to see the bytes of the pre file.

What's a pre spec?

This is a text document containing many "items".

Each "item" consists of:

  1. The source path (the file to bundle).
  2. The destination path (inside the pre file).

Here's an example of a pre spec containing 4 items:

C:\mod\build\qb\_mods\byxor_debug.qb
qb\_mods\byxor_debug.qb

C:\mod\build\qb\_mods\byxor_menu.qb
qb\_mods\byxor_menu.qb

C:\mod\build\qb\_mods\byxor_math.qb
qb\_mods\byxor_math.qb

C:\mod\qdir.txt
code\qb\qdir.txt

Note

  • Only pre version 3 is supported at the moment.
  • None of the items inside the pre file will be compressed.
  • You can use relative paths too.

Pre-release 0.4

03 Dec 16:49
Compare
Choose a tag to compare
Pre-release 0.4 Pre-release
Pre-release
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Release 0.4

Usage of ns:
  -c string
        Specify a file to compile (.ns).
  -decompileWithRoq
        Display output from roq decompiler (roq.exe must be in your PATH).
  -o string
        Specify the output file name.
  -showHexDump
        Display the compiled bytecode in hex format.


image

This build adds experimental shorthand syntax to return booleans from scripts that aren't registered as "member functions" within the engine:

When we have a script that returns true or false...
We can use @ before invoking it to use its return value as the condition of our if-statement.

Example 1

script YourCode {
    if @ YourBooleanScript {
        printf "Your script returned true"
    }
}

script YourBooleanScript {
    if Something {
        return true
    } else {
        return false
    }
}

Behind the scenes, this gets translated to:

script YourCode {
    YourBooleanScript
    if (<__boolean_value__> = 1) {
        printf "Your script returned true"
    }
}

script YourBooleanScript {
    if Something {
        return __boolean_value__ = 1
    } else {
        return __boolean_value__ = 0
    }
}

Example 2

if @(is_north) {
    printf "north"
} else if @(is_east) {
    printf "east"
} else if @(is_south) {
    printf "south"
} else if @(is_west) {
    printf "west"
}

Which gets translated to:

(is_north)
if (<__boolean_value__> = 1) {
    printf "north"
} else {
    (is_east)
    if (<__boolean_value__> = 1) {
        printf "east"
    } else {
        (is_south)
        if (<__boolean_value__> = 1) {
            printf "south"
        } else {
            (is_west)
            if (<__boolean_value__> = 1) {
                printf "west"
            }
        }
    }
}

Whatever the next expression after @ is, it will be moved to its own line before the if-statement.

Pre-release 0.3

03 Sep 23:31
Compare
Choose a tag to compare
Pre-release 0.3 Pre-release
Pre-release
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Release 0.3

Usage of ns:
  -c string
        Specify a file to compile (.ns).
  -decompileWithRoq
        Display output from roq decompiler (roq.exe must be in your PATH).
  -o string
        Specify the output file name.
  -showHexDump
        Display the compiled bytecode in hex format.


Some more syntax examples (but not all features covered): https://github.com/byxor/NeverScript/blob/e35acbb9a9b1a7b1dc7a50b531596288bf615d82/compiler/tests/verify_consistent_compiler_output.go#L100

This release contains a lot of bugfixes and compatibility improvements for comparison operators.

NameOfScript \
    param1 = 1 \
    param2 = 2

will no longer break the parser 👍

I've forgotten the rest to be honest.
Still a lot of work needing to be done.

Pre-release 0.2

30 Aug 19:16
Compare
Choose a tag to compare
Pre-release 0.2 Pre-release
Pre-release
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Release 0.2

Usage of ns.exe:
  -c string
        Specify a file to compile (.ns).
  -decompileWithRoq
        Display output from roq decompiler (roq.exe must be in your PATH)
  -o string
        Specify the output file name.
  -showHexDump
        Display the compiled bytecode in hex format

Patch notes:

  • In-place operators e.g. Change my_var += 200 <foo> += 0.2
  • Fixed return crash when no parameters present.
  • Removed unusable decompiler flags.
  • Version number visible in output.

(Maybe a few other things I can't remember)

Still plenty of bugs, especially surrounding escaped newlines \. If you encounter a bug, I'd appreciate any feedback that helps me fix it.

Pre-release 0.1

29 Aug 04:14
e256bf4
Compare
Choose a tag to compare
Pre-release 0.1 Pre-release
Pre-release
     __                    __           _       _
  /\ \ \_____   _____ _ __/ _\ ___ _ __(_)_ __ | |_
 /  \/ / _ \ \ / / _ \ '__\ \ / __| '__| | '_ \| __|
/ /\  /  __/\ V /  __/ |  _\ \ (__| |  | | |_) | |_
\_\ \/ \___| \_/ \___|_|  \__/\___|_|  |_| .__/ \__|
                                         |_|
           The QB programming language.
----------------------------------------------------

Usage of ns:
  -c string
        Specify a file to compile (.ns).
  -d string
        Specify a file to decompile (.qb).
  -decompileWithRoq
        Display output from roq decompiler (roq.exe must be in your PATH)
  -o string
        Specify the output file name.
  -showHexDump
        Display the compiled bytecode in hex format
  • Has a number of known bugs.
  • Isn't feature-complete yet.
  • Compiler is usable, at least for my needs 😁