2022-06-20 20:32:29 -07:00
|
|
|
pub mod aggregator;
|
2022-06-15 09:33:52 -07:00
|
|
|
pub mod assembler;
|
2022-06-20 20:32:29 -07:00
|
|
|
mod ast;
|
2022-09-18 09:45:31 -07:00
|
|
|
pub(crate) mod constants;
|
2022-08-03 09:57:40 -07:00
|
|
|
mod cost_estimator;
|
2022-07-14 11:31:47 -07:00
|
|
|
pub(crate) mod keccak_util;
|
2023-01-14 21:18:58 -08:00
|
|
|
pub mod opcodes;
|
2022-07-25 09:36:26 -07:00
|
|
|
mod optimizer;
|
2022-06-20 20:32:29 -07:00
|
|
|
mod parser;
|
2022-08-04 17:14:07 -05:00
|
|
|
pub mod stack;
|
2022-07-31 11:58:41 -07:00
|
|
|
mod utils;
|
2022-06-27 18:08:03 -07:00
|
|
|
|
2022-07-28 10:35:53 +02:00
|
|
|
#[cfg(test)]
|
|
|
|
|
mod interpreter;
|
2022-07-13 18:48:25 +02:00
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests;
|
2022-07-07 16:53:06 +02:00
|
|
|
|
2022-06-27 18:08:03 -07:00
|
|
|
use assembler::assemble;
|
|
|
|
|
use parser::parse;
|
|
|
|
|
|
2022-08-01 14:49:28 -07:00
|
|
|
use crate::cpu::kernel::constants::evm_constants;
|
2022-07-08 08:56:46 -07:00
|
|
|
|
2022-06-27 18:08:03 -07:00
|
|
|
/// Assemble files, outputting bytes.
|
|
|
|
|
/// This is for debugging the kernel only.
|
|
|
|
|
pub fn assemble_to_bytes(files: &[String]) -> Vec<u8> {
|
|
|
|
|
let parsed_files: Vec<_> = files.iter().map(|f| parse(f)).collect();
|
2022-07-25 09:36:26 -07:00
|
|
|
let kernel = assemble(parsed_files, evm_constants(), true);
|
2022-06-27 18:08:03 -07:00
|
|
|
kernel.code
|
|
|
|
|
}
|