(draft; work in progress)
See also:
- Compilers
- Program analysis:
- Dynamic analysis - instrumentation, translation, sanitizers
| #![allow(unused)] | |
| use std::marker::PhantomData; | |
| trait Nat {} | |
| struct Zero; | |
| impl Nat for Zero {} | |
| struct Succ<N: Nat>(PhantomData<N>); |
(draft; work in progress)
See also:
| From c7480bb740e0e04cb5d4c84c8b8851bf855b5111 Mon Sep 17 00:00:00 2001 | |
| From: hsqStephenZhang <[email protected]> | |
| Date: Wed, 29 Oct 2025 19:51:18 +0100 | |
| Subject: [PATCH] fix grammar | |
| --- | |
| fuzzer/fuzzer.py | 34 +++++--- | |
| fuzzer/grammar.py | 206 +++++++++++++++++++++++++++++----------------- | |
| 2 files changed, 156 insertions(+), 84 deletions(-) |
| /* | |
| [dependencies] | |
| nix = { version = "0.30.0", features = ["term", "process", "poll"] } | |
| */ | |
| use nix::libc; | |
| use nix::pty::{ForkptyResult, Winsize, forkpty}; | |
| use nix::sys::time::{TimeVal, TimeValLike}; | |
| use nix::sys::{select, termios}; | |
| use nix::sys::termios::{Termios, SetArg}; |
| /** Cargo.toml | |
| [dependencies] | |
| nix = { version = "0.30.0", features = ["term", "process", "poll"] } | |
| */ | |
| use nix::libc; | |
| use nix::pty::{ForkptyResult, Winsize, forkpty}; | |
| use nix::sys::termios::{SetArg, Termios}; | |
| use nix::sys::time::{TimeVal, TimeValLike}; | |
| use nix::sys::{select, termios}; | |
| use nix::unistd::execvp; |
| use std::collections::{HashMap, HashSet}; | |
| #[derive(Debug, Clone, PartialEq, Eq, Hash)] | |
| struct TraitId(&'static str); // e.g., "A", "B", ... | |
| #[derive(Debug)] | |
| struct TraitDef { | |
| id: TraitId, | |
| supertraits: Vec<TraitId>, | |
| methods: Vec<&'static str>, |
| import time | |
| import regex | |
| from lark import Lark, UnexpectedInput | |
| from tabulate import tabulate | |
| def run_test(size): | |
| test_input = 'a' * size + 'b' # Input that will cause regex backtracking | |
| results = [] | |
| # ------------------- |
| use std::collections::HashMap; | |
| use std::sync::Arc; | |
| use std::sync::atomic::{AtomicUsize, Ordering}; | |
| use std::thread; | |
| /// notice: | |
| /// 1. we have to introduce some random delay before the actual store-load operation, or it's very unlikely to observe the reordering. | |
| /// 2. if there is a mfence between the store and load instruction, then it's impossible to observe (0, 0) pair, and chance for observing (1, 1) greatly increased. | |
| /// a. if mfence(fence with SeqCst Ordering) is not enabled, then the output might look like: `pair: (1, 0), count: 5647 pair: (0, 1), count: 94351 pair: (0, 0), count: 2` | |
| /// b. if mfence is enabled, then the output looks like:`pair: (0, 1), count: 94440 pair: (1, 0), count: 5538 pair: (1, 1), count: 22` |
| use boring::ssl::{SslConnector, SslCurve, SslMethod}; | |
| use bytes::{Bytes, BytesMut}; | |
| use futures::StreamExt; | |
| use http_body_util::{BodyStream, Empty}; | |
| use hyper_boring::{HttpsLayer, TokioHttpConnector}; | |
| use hyper_util::client::legacy::connect::HttpConnector; | |
| use hyper_util::client::legacy::Client; | |
| use hyper_util::rt::{TokioExecutor, TokioIo}; | |
| use tower::util::MapResponse; | |
| use tower::Layer; |
| use std::os::fd::AsRawFd; | |
| use tokio::io::{self, AsyncReadExt, AsyncWriteExt}; | |
| use tokio::net::TcpStream; | |
| use std::fmt; | |
| pub struct TcpInfo(pub libc::tcp_info); | |
| impl fmt::Debug for TcpInfo { |