Mercurial > repo
view interps/boof/boof.h @ 12298:cea93c2c666a draft
<b_jonas> learn Burlesque is only the sexiest language on Earth. mroman created it for finance analysis because the traditionally used K and Dyalog APL are unreadable. (See: http://mroman.ch/burlesque )
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Sat, 04 Jan 2020 22:50:21 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
#ifndef boof_h_ #define boof_h_ /* A boolpit is an infinite array of bools (growable at both ends) */ /* boof.h - by Sam Hughes - boof@samuelhughes.com */ #include <string> #include <iostream> #include <vector> class boolpit { unsigned char * beg_; unsigned char * mid_; unsigned char * end_; public: boolpit(); boolpit(const boolpit & copyee); ~boolpit(); boolpit & operator=(const boolpit & assignee); void set(size_t offset, int i); int get(size_t offset); void flip(size_t offset); private: void copy(const boolpit & copyee); void grow_and_accommodate(unsigned char * & p); }; class boofer { struct size_triad { size_t lpos, rjump, bjump; size_triad(size_t a, size_t b, size_t c) : lpos(a), rjump(b), bjump(c) {} }; std::string prog_; std::vector<size_triad> brace_pos_; public: boofer(std::istream & istr); void execute(std::istream & in, std::ostream & out) const; }; #endif