This crate defines a single macro that is a brainfunct compile-time interpreter.

Overview

Compile Protection

This crate defines a single macro that is a brainfunct compile-time interpreter. One example is as follows

#![recursion_limit = "18446744073709551615"]
#![feature(const_mut_refs)]

use program_protected_compile::brainfunct_protect;

fn main() {
    brainfunct_protect!("/,./+@", "1", "1");
}

brainfunct_protect! generates const functions that can be consumed at compile time to run the brain funct program with the provided input "1", and it expects the output "1".

The syntax is as follows:

brainfunct_protect!(
    "brainfunct legal program", 
    "input to give to the program", 
    "the output to expect from the program"
);

If the program given the input produces the given output, then the rest of the rust program will compile. However, if the program produces the incorrect output, it will recursively loop infinitely or until the user cancels the compile.

This is trivial to beat if there is nothing keeping them from deleting the macro from the source. But is nontrivial otherwise.

The recursion limit being set so high prevents the recursive const functions that are being generated from accidentally going over the recursion limit.

You might also like...
rlox-interpreter is an AST-walking implementation of Bob Nystrom's Lox language in Rust.

rlox-interpreter rlox-interpreter is an AST-walking implementation of Bob Nystrom's Lox language in Rust. Disclaimer: This is my first Rust project, d

A Brainf** interpreter written in rust 🦀

Brainf Interpreter An interpreter for the esoteric programming language Brainfuck written in rust 🦀 Compilation NOTE: To compile the project, you nee

Risc-V assembly interpreter built with pure Rust
Risc-V assembly interpreter built with pure Rust

Risc-V Interpreter Interpreter for Risc-V assembly built with Rust Report bug · Request feature Table of contents Quick start Exemple Program Instruct

Brainf - A brainfuck interpreter written in Rust 🦀

brainf A brainfuck interpreter written in Rust 🦀 . Do not I wrote this in my spare time... but still its good! Run Locally Clone the project git cl

Brainfu*k interpreter and REPL written in Rust🦀
Brainfu*k interpreter and REPL written in Rust🦀

brainfuck interpreter: a simple brainfuck interpreter and REPL writen in rust 🦀 Read this in other languages. AR Arabic-العربية Features Run brainfuc

A fast, powerful and configurable interpreter written in Rust

brainfuck-interpreter Overview A fast, powerful and configurable interpreter written in Rust, which allows various options to meet different demends,

A simple interpreter written in Rust programming language.

Interpreter in Rust A simple interpreter written in Rust programming language. Getting Started These instructions will get you a copy of the project u

Regorus - Rego interpreter, analyzer and validator written in Rust

regorus THIS REPOSITORY IS IN ACTIVE DEVELOPMENT AND NOT INTENDED FOR PRODUCTION USE. Regorus is a Rego interpreter, analyzer and checker written in R

Compiler & Interpreter for the (rather new and very experimental) Y programming language.

Y Lang Why would anyone build a new (and rather experimental) language with no real world use case. Design Y (pronounced as why) is based on the idea

Owner
John Marsden
John Marsden
`fugit` provides a comprehensive library of `Duration` and `Instant` for the handling of time in embedded systems, doing all it can at compile time.

fugit fugit provides a comprehensive library of Duration and Instant for the handling of time in embedded systems, doing all it can at compile time. T

Emil Fresk 40 Oct 2, 2022
Faster division by constants that aren't known at compile-time

Baseline implementation of division by constants When dividing integers by compile-time constants, compilers (LLVM) can be trusted to convert those to

Paul Khuong 18 Jul 6, 2022
constduck: compile-time duck typing and reflection

constduck provides a procmacro that can enable compile time duck typing and reflection on arbitrary struct types.

ferrouille 15 Oct 12, 2022
Allocate memory at compile time!

const-alloc Link to the docs! Allocate memory at compile time! Currently, in stable rust there is no way to dynamically allocate or deallocate memory

Sp00ph 1 Feb 5, 2022
Option and Either types with variants known at compile time.

Const Either Some types to allow deciding at compile time if an option contains a value or which variant from the either type is active. This might be

null 1 May 5, 2022
Compile-time lifetimes for comments.

todo_by Compile-time lifetimes for comments. To use this macro, add it to your dependencies via Cargo: cargo add todo_by Then, import and invoke the m

Parker McMullin 116 May 23, 2023
This crate provides a convenient macro that allows you to generate type wrappers that promise to always uphold arbitrary invariants that you specified.

prae This crate provides a convenient macro that allows you to generate type wrappers that promise to always uphold arbitrary invariants that you spec

null 96 Dec 4, 2022
Example of structuring a proc macro crate for testability

testing-proc-macros Example of structuring a proc macro crate for testability. See accompanying blog post for details. License Licensed under either o

Ferrous Systems 12 Dec 11, 2022
Brainfuck interpreter written in rust

Brainfuck Interpreter Written in Rust Simple Interpreter that runs bare Brainfuck and extends it with debug command # which prints content of first te

Was 1 Nov 28, 2021
The brainfuck language interpreter written in Rust

The brainfuck language interpreter written in Rust

Jan Štaffa 1 Feb 21, 2022