diff options
26 files changed, 7121 insertions, 0 deletions
| -rw-r--r-- | spasm/src/asm/assembler.cpp | 212 | ||||
| -rw-r--r-- | spasm/src/asm/assembler.hpp | 36 | ||||
| -rw-r--r-- | spasm/src/asm/bytecode.cpp | 120 | ||||
| -rw-r--r-- | spasm/src/asm/bytecode.hpp | 69 | ||||
| -rw-r--r-- | spasm/src/asm/dfa.dot | 180 | ||||
| -rw-r--r-- | spasm/src/asm/dfa.svg | 1367 | ||||
| -rw-r--r-- | spasm/src/asm/lexdump.cpp | 83 | ||||
| -rw-r--r-- | spasm/src/asm/lexdump3.cpp | 62 | ||||
| -rw-r--r-- | spasm/src/asm/lexer.cpp | 3106 | ||||
| -rw-r--r-- | spasm/src/asm/lexer.hpp | 67 | ||||
| -rw-r--r-- | spasm/src/asm/lexer.re | 364 | ||||
| -rw-r--r-- | spasm/src/asm/main.cpp | 22 | ||||
| -rw-r--r-- | spasm/src/asm/symbol.cpp | 121 | ||||
| -rw-r--r-- | spasm/src/asm/symbol.hpp | 69 | ||||
| -rw-r--r-- | spasm/src/asm/token.cpp | 79 | ||||
| -rw-r--r-- | spasm/src/asm/token.hpp | 94 | ||||
| -rw-r--r-- | spasm/src/asm/tokenizer.cpp | 51 | ||||
| -rw-r--r-- | spasm/src/asm/tokenizer.hpp | 35 | ||||
| -rw-r--r-- | spasm/src/main.cpp | 34 | ||||
| -rw-r--r-- | spasm/src/program.spa | 12 | ||||
| -rw-r--r-- | spasm/src/spasm.cpp | 517 | ||||
| -rw-r--r-- | spasm/src/spasm.hpp | 15 | ||||
| -rw-r--r-- | spasm/src/spasm_impl.hpp | 164 | ||||
| -rw-r--r-- | spasm/src/string.hpp | 43 | ||||
| -rw-r--r-- | spasm/src/types.hpp | 24 | ||||
| -rw-r--r-- | spasm/src/value.hpp | 175 |
diff --git a/spasm/src/asm/assembler.cpp b/spasm/src/asm/assembler.cpp new file mode 100644 index 0000000..1f69b1a --- /dev/null +++ b/spasm/src/asm/assembler.cpp @@ -0,0 +1,212 @@ +#include <cassert> + +#include "assembler.hpp" +#include "bytecode.hpp" +#include "symbol.hpp" +#include "tokenizer.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +Assembler::Assembler(Lexer::Tokenizer& tokenizer, Bytecode_Stream& bytecode) + : _tokenizer(&tokenizer), _bytecode(&bytecode) +{ +} + +int get_arg_size(const Lexer::Token args[]) +{ + int size = 0; + for (int i = 0; i < 3; ++i) + { + switch (args[i].type()) + { + case Lexer::Token::Integer: + case Lexer::Token::XInteger: + { + if (args[i].value_int() > 0xffffffff) + { + size = std::max(size, 3); + } + else if (args[i].value_int() > 0xffff) + { + size = std::max(size, 2); + } + else if (args[i].value_int() > 0xff) + { + size = std::max(size, 1); + } + else if (args[i].value_int() < -0xffffffffLL) + { + size = std::max(size, 3); + } + else if (args[i].value_int() < -0xffff) + { + size = std::max(size, 2); + } + else if (args[i].value_int() < -0xff) + { + size = std::max(size, 1); + } + break; + } + case Lexer::Token::FloatingPoint: + { + size = std::max(size, 3); + break; + } + case Lexer::Token::StringValue: + { + const auto length = args[i].value_str().size(); + if (length > 0xffffffff) + { + size = std::max(size, 3); + } + else if (length > 0xffff) + { + size = std::max(size, 2); + } + else if (length > 0xff) + { + size = std::max(size, 1); + } + break; + } + default: + break; + } + } + return size; +} + +void Assembler::assemble() +{ + Lexer::Token token = _tokenizer->next_token(); + + while (token.type() != Lexer::Token::EndInput) + { + const auto type = token.type(); + if (type >= Lexer::Token::_NotOpCodeBegin) + { + switch (token.type()) + { + case Lexer::Token::Ident: + assemble_identifier(token); + break; + case Lexer::Token::Label: + token = _tokenizer->next_token(); + assert(token.type() == Lexer::Token::Ident); + _symbols.define(token.value_str(), _bytecode->size()); + break; + default: + break; + } + } + else + { + Lexer::Token args[3]; + if (type >= Lexer::Token::_OneArgBegin) + { + args[0] = _tokenizer->next_token(); + } + if (type >= Lexer::Token::_TwoArgBegin) + { + args[1] = _tokenizer->next_token(); + } + if (type >= Lexer::Token::_ThreeArgBegin) + { + args[2] = _tokenizer->next_token(); + } + const auto size = get_arg_size(args); + _bytecode->push_opcode( + (Bytecode_Stream::Opcode_t)((size << 6) | token.type())); + const auto arg_size = 1 << size; + + if (args[0].type() != Lexer::Token::NotUsed) + { + if (type == Lexer::Token::Call || type == Lexer::Token::Jump) + { + assert(args[0].type() == Lexer::Token::Ident); + assemble_identifier(args[0]); + } + else + { + assert(args[0].type() == Lexer::Token::Integer); + _bytecode->push_integer(args[0].value_int(), arg_size); + } + } + if (args[1].type() != Lexer::Token::NotUsed) + { + if (type == Lexer::Token::JumpF || type == Lexer::Token::JumpT) + { + assert(args[1].type() == Lexer::Token::Ident); + assemble_identifier(args[1]); + } + else if (type == Lexer::Token::String) + { + assert(args[1].type() == Lexer::Token::StringValue); + const auto& s = args[1].value_str(); + _bytecode->push_string(s.data(), s.size(), arg_size); + } + else + { + if (args[1].type() == Lexer::Token::Integer) + { + _bytecode->push_integer(args[1].value_int(), arg_size); + } + else if (args[1].type() == Lexer::Token::FloatingPoint) + { + _bytecode->push_double(args[1].value_double()); + } + else + { + assert(false && "expected a number type"); + } + } + } + if (args[2].type() != Lexer::Token::NotUsed) + { + assert(args[2].type() == Lexer::Token::Integer); + _bytecode->push_integer(args[2].value_int(), arg_size); + } + } + + token = _tokenizer->next_token(); + } + + Symbol_Table::const_iterator i = _symbols.begin(); + while (i != _symbols.end()) + { + backpatch(i->second); + ++i; + } +} + +void Assembler::backpatch(const Symbol* symbol) +{ + Symbol::Positions_t::const_iterator i = symbol->positions_begin(); + while (i != symbol->positions_end()) + { + _bytecode->set_location(*i, symbol->definition()); + ++i; + } +} + +void Assembler::assemble_identifier(const Lexer::Token& token) +{ + Symbol* symbol = _symbols.insert(token.value_str(), _bytecode->size()); + _bytecode->push_location(symbol->definition()); +} + +bool compile(std::istream& istr, Bytecode_Stream& bytecode) +{ + Lexer::Tokenizer tokenizer(istr); + Assembler assembler(tokenizer, bytecode); + + assembler.assemble(); + + return true; +} + +} // namespace ASM +} // namespace SpasmImpl diff --git a/spasm/src/asm/assembler.hpp b/spasm/src/asm/assembler.hpp new file mode 100644 index 0000000..90e8815 --- /dev/null +++ b/spasm/src/asm/assembler.hpp @@ -0,0 +1,36 @@ +#ifndef ASSEMBPLER_HPP +#define ASSEMBPLER_HPP + +#include <iostream> + +#include "bytecode.hpp" +#include "symbol.hpp" +#include "tokenizer.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +class Assembler +{ + public: + Assembler(Lexer::Tokenizer&, Bytecode_Stream&); + + void assemble(); + + private: + void backpatch(const Symbol*); + void assemble_identifier(const Lexer::Token&); + + Lexer::Tokenizer* _tokenizer; + Bytecode_Stream* _bytecode; + + Symbol_Table _symbols; + +}; // class Assembler + +bool compile(std::istream&, Bytecode_Stream& bytecode); +} // namespace ASM +} // namespace SpasmImpl + +#endif // ASSEMBPLER_HPP diff --git a/spasm/src/asm/bytecode.cpp b/spasm/src/asm/bytecode.cpp new file mode 100644 index 0000000..70e16c9 --- /dev/null +++ b/spasm/src/asm/bytecode.cpp @@ -0,0 +1,120 @@ +#include <fstream> +#include <iostream> +#include <string> +#include <vector> + +#include "bytecode.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +Bytecode_Stream::~Bytecode_Stream() {} + +Bytecode_File::Bytecode_File(const std::string& filename) + : _bytecode(filename.c_str(), std::ios_base::out | std::ios_base::binary) +{ +} + +void Bytecode_File::push_byte(Bytecode_Stream::byte byte) +{ + _bytecode.put(byte); +} + +void Bytecode_File::push_opcode(Bytecode_Stream::Opcode_t opcode) +{ + push_byte(opcode); +} + +union DoubleToBits { + double as_double; + int64_t as_bits; +}; + +int64_t to_bits(double d) +{ + DoubleToBits v; + v.as_double = d; + return v.as_bits; +}; + +void Bytecode_File::push_integer(int64_t number, int size) +{ + for (int i = 0; i < size; ++i) + push_byte((number >> (i << 3)) & 0xff); +} + +void Bytecode_File::push_double(double number) +{ + auto bits = to_bits(number); + for (size_t i = 0; i < sizeof(size_t); ++i) + push_byte((bits >> (i << 3)) & 0xff); +} + +void Bytecode_Memory::push_byte(Bytecode_Stream::byte byte) +{ + _bytecode.push_back(byte); +} + +void Bytecode_Memory::push_opcode(Bytecode_Stream::Opcode_t opcode) +{ + push_byte(opcode); +} + +void Bytecode_Memory::push_integer(int64_t number, int size) +{ + for (int i = 0; i < size; ++i) + push_byte((number >> (i << 3)) & 0xff); +} + +void Bytecode_Memory::push_double(double number) +{ + auto bits = to_bits(number); + for (size_t i = 0; i < sizeof(size_t); ++i) + push_byte((bits >> (i << 3)) & 0xff); +} + +void Bytecode_Memory::set_location(size_t index, size_t location) +{ + if (location <= 0xff) + { + _bytecode[index] = (byte)location; + } + else + { + for (size_t i = 0; i < sizeof(size_t); ++i) + _bytecode.at(index + i) = ((location >> (i << 3)) & 0xff); + } +} + +void Bytecode_Memory::push_location(size_t location) +{ + if (location <= 0xff) + { + push_byte((byte)location); + } + else + { + for (size_t i = 0; i < sizeof(size_t); ++i) + _bytecode.push_back((location >> (i << 3)) & 0xff); + } +} + +void Bytecode_Memory::push_string(const char* s, size_t length, int size) +{ + push_integer(int64_t(length), size); + _bytecode.insert(_bytecode.end(), s, s + length); +} + +const Bytecode_Memory::Bytecode& Bytecode_Memory::bytecode() const +{ + return _bytecode; +} + +size_t Bytecode_Memory::size() const +{ + return _bytecode.size(); +} + +} // namespace ASM +} // namespace SpasmImpl diff --git a/spasm/src/asm/bytecode.hpp b/spasm/src/asm/bytecode.hpp new file mode 100644 index 0000000..bc7f93b --- /dev/null +++ b/spasm/src/asm/bytecode.hpp @@ -0,0 +1,69 @@ +#ifndef BYTECODE_HPP +#define BYTECODE_HPP + +#include <fstream> +#include <iostream> +#include <string> +#include <vector> + +namespace SpasmImpl +{ +namespace ASM +{ +class Bytecode_Stream +{ + public: + typedef int8_t byte; + typedef byte Opcode_t; + + virtual ~Bytecode_Stream(); + virtual void push_opcode(Opcode_t) = 0; + virtual void push_integer(int64_t, int size) = 0; + virtual void push_double(double) = 0; + virtual void push_location(size_t) = 0; + virtual void push_string(const char* s, size_t length, int size) = 0; + virtual void set_location(size_t, size_t) = 0; + virtual size_t size() const = 0; +}; // class Bytecode_Stream + +class Bytecode_File : public Bytecode_Stream +{ + public: + Bytecode_File(const std::string&); + + void push_opcode(Opcode_t) override; + void push_integer(int64_t, int size) override; + void push_double(double) override; + + private: + Bytecode_File(const Bytecode_File&); + Bytecode_File& operator=(const Bytecode_File&); + void push_byte(Bytecode_Stream::byte); + + std::ofstream _bytecode; + +}; // class Bytecode_File + +class Bytecode_Memory : public Bytecode_Stream +{ + public: + void push_opcode(Opcode_t) override; + void push_integer(int64_t, int) override; + void push_double(double) override; + void push_location(size_t) override; + void set_location(size_t, size_t) override; + void push_string(const char* s, size_t length, int size) override; + size_t size() const override; + + typedef std::vector<Bytecode_Stream::byte> Bytecode; + const Bytecode& bytecode() const; + + private: + void push_byte(Bytecode_Stream::byte); + + std::vector<Bytecode_Stream::byte> _bytecode; +}; // class Bytecode_Memory +} // namespace ASM +} // namespace SpasmImpl + +#endif // BYTECODE_HPP diff --git a/spasm/src/asm/dfa.dot b/spasm/src/asm/dfa.dot new file mode 100644 index 0000000..ff38d77 --- /dev/null +++ b/spasm/src/asm/dfa.dot @@ -0,0 +1,180 @@ +/* Generated by re2c 0.16 on Thu Oct 11 01:51:09 2018 */ + +digraph re2c { + +1 -> 2 [label="[0x00]"] +1 -> 4 [label="[0x01-0x08][0x0B-0x1F][!-$][&-)][,][.][:-;][=-@][[-^][`][{-0xFF]"] +1 -> 6 [label="[0x09][ ]"] +1 -> 9 [label="[0x0A]"] +1 -> 11 [label="[%]"] +1 -> 13 [label="[*]"] +1 -> 15 [label="[+]"] +1 -> 17 [label="[-]"] +1 -> 19 [label="[/]"] +1 -> 21 [label="[0]"] +1 -> 23 [label="[1-9]"] +1 -> 25 [label="[<]"] +1 -> 27 [label="[A-Z][_][a-b][e-f][h-k][m-o][q][t-z]"] +1 -> 30 [label="[c]"] +1 -> 31 [label="[d]"] +1 -> 32 [label="[g]"] +1 -> 33 [label="[l]"] +1 -> 34 [label="[p]"] +1 -> 35 [label="[r]"] +1 -> 36 [label="[s]"] +2 -> 3 +3 [label="lexer.re:233"] +4 -> 5 +5 [label="lexer.re:239"] +6 -> 7 +7 -> 8 [label="[0x00-0x08][0x0A-0x1F][!-0xFF]"] +7 -> 6 [label="[0x09][ ]"] +8 [label="lexer.re:220"] +9 -> 10 +10 [label="lexer.re:226"] +11 -> 12 +12 [label="lexer.re:137"] +13 -> 14 +14 [label="lexer.re:123"] +15 -> 16 +16 [label="lexer.re:109"] +17 -> 18 [label="[0x00-/][1-0xFF]"] +17 -> 37 [label="[0]"] +18 [label="lexer.re:116"] +19 -> 20 +20 [label="lexer.re:130"] +21 -> 22 [label="[0x00-W][Y-w][y-0xFF]"] +21 -> 38 [label="[X][x]"] +22 [label="lexer.re:58"] +23 -> 24 +24 -> 22 [label="[0x00-/][:-0xFF]"] +24 -> 23 [label="[0-9]"] +25 -> 26 [label="[0x00-<][>-0xFF]"] +25 -> 40 [label="[=]"] +26 [label="lexer.re:198"] +27 -> 28 +28 -> 29 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +28 -> 27 [label="[0-9][A-Z][_][a-z]"] +29 [label="lexer.re:212"] +30 -> 28 [label="[0x00-`][b-0xFF]"] +30 -> 42 [label="[a]"] +31 -> 28 [label="[0x00-t][v-0xFF]"] +31 -> 43 [label="[u]"] +32 -> 28 [label="[0x00-n][p-0xFF]"] +32 -> 44 [label="[o]"] +33 -> 28 [label="[0x00-`][b-n][p-0xFF]"] +33 -> 46 [label="[a]"] +33 -> 47 [label="[o]"] +34 -> 28 [label="[0x00-n][p-q][s-t][v-0xFF]"] +34 -> 48 [label="[o]"] +34 -> 49 [label="[r]"] +34 -> 50 [label="[u]"] +35 -> 28 [label="[0x00-d][f-0xFF]"] +35 -> 51 [label="[e]"] +36 -> 28 [label="[0x00-s][u-0xFF]"] +36 -> 52 [label="[t]"] +37 -> 22 +38 -> 39 [label="[0x00-/][:-@][G-`][g-0xFF]"] +38 -> 53 [label="[0-9][A-F][a-f]"] +39 -> 22 +40 -> 41 +41 [label="lexer.re:192"] +42 -> 28 [label="[0x00-k][m-0xFF]"] +42 -> 56 [label="[l]"] +43 -> 28 [label="[0x00-o][q-0xFF]"] +43 -> 57 [label="[p]"] +44 -> 45 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +44 -> 27 [label="[0-9][A-Z][_][a-e][g-s][u-z]"] +44 -> 59 [label="[f]"] +44 -> 60 [label="[t]"] +45 [label="lexer.re:158"] +46 -> 28 [label="[0x00-a][c-0xFF]"] +46 -> 61 [label="[b]"] +47 -> 28 [label="[0x00-`][b-0xFF]"] +47 -> 62 [label="[a]"] +48 -> 28 [label="[0x00-o][q-0xFF]"] +48 -> 63 [label="[p]"] +49 -> 28 [label="[0x00-h][j-0xFF]"] +49 -> 65 [label="[i]"] +50 -> 28 [label="[0x00-r][t-0xFF]"] +50 -> 66 [label="[s]"] +51 -> 28 [label="[0x00-`][b-s][u-0xFF]"] +51 -> 67 [label="[a]"] +51 -> 68 [label="[t]"] +52 -> 28 [label="[0x00-n][p-0xFF]"] +52 -> 70 [label="[o]"] +53 -> 54 +54 -> 55 [label="[0x00-/][:-@][G-`][g-0xFF]"] +54 -> 53 [label="[0-9][A-F][a-f]"] +55 [label="lexer.re:66"] +56 -> 28 [label="[0x00-k][m-0xFF]"] +56 -> 71 [label="[l]"] +57 -> 58 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +57 -> 27 [label="[0-9][A-Z][_][a-z]"] +58 [label="lexer.re:88"] +59 -> 28 [label="[0x00-`][b-0xFF]"] +59 -> 73 [label="[a]"] +60 -> 28 [label="[0x00-q][s-0xFF]"] +60 -> 74 [label="[r]"] +61 -> 28 [label="[0x00-d][f-0xFF]"] +61 -> 75 [label="[e]"] +62 -> 28 [label="[0x00-c][e-0xFF]"] +62 -> 76 [label="[d]"] +63 -> 64 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +63 -> 27 [label="[0-9][A-Z][_][a-z]"] +64 [label="lexer.re:81"] +65 -> 28 [label="[0x00-m][o-0xFF]"] +65 -> 78 [label="[n]"] +66 -> 28 [label="[0x00-g][i-0xFF]"] +66 -> 79 [label="[h]"] +67 -> 28 [label="[0x00-c][e-0xFF]"] +67 -> 81 [label="[d]"] +68 -> 69 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +68 -> 27 [label="[0-9][A-Z][_][a-z]"] +69 [label="lexer.re:172"] +70 -> 28 [label="[0x00-q][s-0xFF]"] +70 -> 83 [label="[r]"] +71 -> 72 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +71 -> 27 [label="[0-9][A-Z][_][a-z]"] +72 [label="lexer.re:165"] +73 -> 28 [label="[0x00-k][m-0xFF]"] +73 -> 84 [label="[l]"] +74 -> 28 [label="[0x00-t][v-0xFF]"] +74 -> 85 [label="[u]"] +75 -> 28 [label="[0x00-k][m-0xFF]"] +75 -> 86 [label="[l]"] +76 -> 77 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +76 -> 27 [label="[0-9][A-Z][_][a-z]"] +77 [label="lexer.re:179"] +78 -> 28 [label="[0x00-s][u-0xFF]"] +78 -> 88 [label="[t]"] +79 -> 80 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +79 -> 27 [label="[0-9][A-Z][_][a-z]"] +80 [label="lexer.re:74"] +81 -> 82 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +81 -> 27 [label="[0-9][A-Z][_][a-z]"] +82 [label="lexer.re:95"] +83 -> 28 [label="[0x00-d][f-0xFF]"] +83 -> 90 [label="[e]"] +84 -> 28 [label="[0x00-r][t-0xFF]"] +84 -> 92 [label="[s]"] +85 -> 28 [label="[0x00-d][f-0xFF]"] +85 -> 93 [label="[e]"] +86 -> 87 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +86 -> 27 [label="[0-9][A-Z][_][a-z]"] +87 [label="lexer.re:205"] +88 -> 89 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +88 -> 27 [label="[0-9][A-Z][_][a-z]"] +89 [label="lexer.re:102"] +90 -> 91 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +90 -> 27 [label="[0-9][A-Z][_][a-z]"] +91 [label="lexer.re:186"] +92 -> 28 [label="[0x00-d][f-0xFF]"] +92 -> 95 [label="[e]"] +93 -> 94 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +93 -> 27 [label="[0-9][A-Z][_][a-z]"] +94 [label="lexer.re:144"] +95 -> 96 [label="[0x00-/][:-@][[-^][`][{-0xFF]"] +95 -> 27 [label="[0-9][A-Z][_][a-z]"] +96 [label="lexer.re:151"] +} diff --git a/spasm/src/asm/dfa.svg b/spasm/src/asm/dfa.svg new file mode 100644 index 0000000..0bd3660 --- /dev/null +++ b/spasm/src/asm/dfa.svg @@ -0,0 +1,1367 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<!-- Generated by graphviz version 2.38.0 (20140413.2041) + --> +<!-- Title: re2c Pages: 1 --> +<svg width="6745pt" height="935pt" + viewBox="0.00 0.00 6745.30 935.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 931)"> +<title>re2c</title> +<polygon fill="white" stroke="none" points="-4,4 -4,-931 6741.3,-931 6741.3,4 -4,4"/> +<!-- 1 --> +<g id="node1" class="node"><title>1</title> +<ellipse fill="none" stroke="black" cx="1178.3" cy="-909" rx="27" ry="18"/> +<text text-anchor="middle" x="1178.3" y="-905.3" font-family="Times,serif" font-size="14.00">1</text> +</g> +<!-- 2 --> +<g id="node2" class="node"><title>2</title> +<ellipse fill="none" stroke="black" cx="81.2953" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="81.2953" y="-818.3" font-family="Times,serif" font-size="14.00">2</text> +</g> +<!-- 1->2 --> +<g id="edge1" class="edge"><title>1->2</title> +<path fill="none" stroke="black" d="M1151.22,-908.173C1014.84,-908.869 402.367,-909.855 216.295,-873 179.175,-865.648 138.741,-849.503 111.898,-837.537"/> +<polygon fill="black" stroke="black" points="113.207,-834.288 102.654,-833.342 110.314,-840.662 113.207,-834.288"/> +<text text-anchor="middle" x="234.795" y="-861.8" font-family="Times,serif" font-size="14.00">[0x00]</text> +</g> +<!-- 4 --> +<g id="node3" class="node"><title>4</title> +<ellipse fill="none" stroke="black" cx="209.295" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="209.295" y="-818.3" font-family="Times,serif" font-size="14.00">4</text> +</g> +<!-- 1->4 --> +<g id="edge2" class="edge"><title>1->4</title> +<path fill="none" stroke="black" d="M1151.28,-907.762C1011.46,-906.419 373.339,-898.904 289.295,-873 269.015,-866.749 248.77,-854.017 233.72,-842.966"/> +<polygon fill="black" stroke="black" points="235.577,-839.981 225.498,-836.715 231.34,-845.554 235.577,-839.981"/> +<text text-anchor="middle" x="469.795" y="-861.8" font-family="Times,serif" font-size="14.00">[0x01-0x08][0x0B-0x1F][!-$][&-)][,][.][:-;][=-@][[-^][`][{-0xFF]</text> +</g> +<!-- 6 --> +<g id="node4" class="node"><title>6</title> +<ellipse fill="none" stroke="black" cx="309.295" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="309.295" y="-818.3" font-family="Times,serif" font-size="14.00">6</text> +</g> +<!-- 1->6 --> +<g id="edge3" class="edge"><title>1->6</title> +<path fill="none" stroke="black" d="M1151.3,-906.62C1082.97,-902.954 897.716,-891.937 744.295,-873 704.049,-868.032 694.579,-862.654 654.295,-858 531.74,-843.841 499.188,-859.038 377.295,-840 366.18,-838.264 354.224,-835.564 343.484,-832.824"/> +<polygon fill="black" stroke="black" points="344.19,-829.39 333.627,-830.214 342.398,-836.157 344.19,-829.39"/> +<text text-anchor="middle" x="768.795" y="-861.8" font-family="Times,serif" font-size="14.00">[0x09][ ]</text> +</g> +<!-- 9 --> +<g id="node5" class="node"><title>9</title> +<ellipse fill="none" stroke="black" cx="413.295" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="413.295" y="-818.3" font-family="Times,serif" font-size="14.00">9</text> +</g> +<!-- 1->9 --> +<g id="edge4" class="edge"><title>1->9</title> +<path fill="none" stroke="black" d="M1151.37,-906.619C1095.18,-903.408 961.494,-894.055 851.295,-873 826.829,-868.325 821.858,-862.138 797.295,-858 671.702,-836.842 637.783,-854.906 511.295,-840 490.555,-837.556 467.54,-833.627 449.028,-830.162"/> +<polygon fill="black" stroke="black" points="449.454,-826.68 438.975,-828.243 448.142,-833.556 449.454,-826.68"/> +<text text-anchor="middle" x="871.295" y="-861.8" font-family="Times,serif" font-size="14.00">[0x0A]</text> +</g> +<!-- 11 --> +<g id="node6" class="node"><title>11</title> +<ellipse fill="none" stroke="black" cx="547.295" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="547.295" y="-818.3" font-family="Times,serif" font-size="14.00">11</text> +</g> +<!-- 1->11 --> +<g id="edge5" class="edge"><title>1->11</title> +<path fill="none" stroke="black" d="M1151.29,-906.318C1105.54,-902.991 1010.19,-893.991 932.295,-873 915.162,-868.383 912.594,-861.951 895.295,-858 773.293,-830.133 737.916,-859.472 614.295,-840 603.425,-838.288 591.746,-835.621 581.233,-832.903"/> +<polygon fill="black" stroke="black" points="582.139,-829.523 571.574,-830.312 580.325,-836.284 582.139,-829.523"/> +<text text-anchor="middle" x="943.295" y="-861.8" font-family="Times,serif" font-size="14.00">[%]</text> +</g> +<!-- 13 --> +<g id="node7" class="node"><title>13</title> +<ellipse fill="none" stroke="black" cx="650.295" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="650.295" y="-818.3" font-family="Times,serif" font-size="14.00">13</text> +</g> +<!-- 1->13 --> +<g id="edge6" class="edge"><title>1->13</title> +<path fill="none" stroke="black" d="M1151.54,-905.771C1113.82,-902.041 1043.23,-892.889 986.295,-873 972.967,-868.344 971.832,-862.008 958.295,-858 866.776,-830.902 838.919,-852.507 744.295,-840 724.779,-837.42 703.151,-833.578 685.566,-830.198"/> +<polygon fill="black" stroke="black" points="686.212,-826.758 675.726,-828.275 684.869,-833.629 686.212,-826.758"/> +<text text-anchor="middle" x="994.295" y="-861.8" font-family="Times,serif" font-size="14.00">[*]</text> +</g> +<!-- 15 --> +<g id="node8" class="node"><title>15</title> +<ellipse fill="none" stroke="black" cx="780.295" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="780.295" y="-818.3" font-family="Times,serif" font-size="14.00">15</text> +</g> +<!-- 1->15 --> +<g id="edge7" class="edge"><title>1->15</title> +<path fill="none" stroke="black" d="M1151.89,-904.84C1121.17,-900.493 1069.43,-891.065 1028.3,-873 1017.46,-868.241 1017.39,-862.12 1006.3,-858 939.626,-833.242 917.257,-852.775 847.295,-840 836.582,-838.044 825.045,-835.338 814.614,-832.66"/> +<polygon fill="black" stroke="black" points="815.186,-829.191 804.623,-830.021 813.397,-835.959 815.186,-829.191"/> +<text text-anchor="middle" x="1037.3" y="-861.8" font-family="Times,serif" font-size="14.00">[+]</text> +</g> +<!-- 17 --> +<g id="node9" class="node"><title>17</title> +<ellipse fill="none" stroke="black" cx="883.295" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="883.295" y="-818.3" font-family="Times,serif" font-size="14.00">17</text> +</g> +<!-- 1->17 --> +<g id="edge8" class="edge"><title>1->17</title> +<path fill="none" stroke="black" d="M1155.44,-899.339C1137.01,-892.324 1110.44,-882.141 1087.3,-873 1070.79,-866.481 1067.27,-863.174 1050.3,-858 1006,-844.497 953.527,-834.434 919.384,-828.645"/> +<polygon fill="black" stroke="black" points="919.844,-825.173 909.405,-826.986 918.696,-832.079 919.844,-825.173"/> +<text text-anchor="middle" x="1094.3" y="-861.8" font-family="Times,serif" font-size="14.00">[-]</text> +</g> +<!-- 19 --> +<g id="node10" class="node"><title>19</title> +<ellipse fill="none" stroke="black" cx="1217.3" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="1217.3" y="-818.3" font-family="Times,serif" font-size="14.00">19</text> +</g> +<!-- 1->19 --> +<g id="edge9" class="edge"><title>1->19</title> +<path fill="none" stroke="black" d="M1185.81,-891.611C1191.43,-879.382 1199.2,-862.443 1205.62,-848.456"/> +<polygon fill="black" stroke="black" points="1208.81,-849.887 1209.8,-839.339 1202.45,-846.968 1208.81,-849.887"/> +<text text-anchor="middle" x="1206.8" y="-861.8" font-family="Times,serif" font-size="14.00">[/]</text> +</g> +<!-- 21 --> +<g id="node11" class="node"><title>21</title> +<ellipse fill="none" stroke="black" cx="1047.3" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="1047.3" y="-818.3" font-family="Times,serif" font-size="14.00">21</text> +</g> +<!-- 1->21 --> +<g id="edge10" class="edge"><title>1->21</title> +<path fill="none" stroke="black" d="M1159.53,-895.822C1137.25,-881.367 1099.93,-857.149 1074.49,-840.644"/> +<polygon fill="black" stroke="black" points="1076.32,-837.663 1066.03,-835.156 1072.51,-843.535 1076.32,-837.663"/> +<text text-anchor="middle" x="1129.3" y="-861.8" font-family="Times,serif" font-size="14.00">[0]</text> +</g> +<!-- 23 --> +<g id="node12" class="node"><title>23</title> +<ellipse fill="none" stroke="black" cx="1145.3" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="1145.3" y="-818.3" font-family="Times,serif" font-size="14.00">23</text> +</g> +<!-- 1->23 --> +<g id="edge11" class="edge"><title>1->23</title> +<path fill="none" stroke="black" d="M1167.39,-892.157C1163.77,-886.335 1159.98,-879.56 1157.3,-873 1154.32,-865.728 1151.98,-857.547 1150.18,-849.942"/> +<polygon fill="black" stroke="black" points="1153.58,-849.108 1148.05,-840.067 1146.73,-850.579 1153.58,-849.108"/> +<text text-anchor="middle" x="1171.3" y="-861.8" font-family="Times,serif" font-size="14.00">[1-9]</text> +</g> +<!-- 25 --> +<g id="node13" class="node"><title>25</title> +<ellipse fill="none" stroke="black" cx="1329.3" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="1329.3" y="-818.3" font-family="Times,serif" font-size="14.00">25</text> +</g> +<!-- 1->25 --> +<g id="edge12" class="edge"><title>1->25</title> +<path fill="none" stroke="black" d="M1198.35,-896.713C1224.52,-881.979 1270.51,-856.093 1300.43,-839.249"/> +<polygon fill="black" stroke="black" points="1302.16,-842.289 1309.16,-834.334 1298.73,-836.189 1302.16,-842.289"/> +<text text-anchor="middle" x="1272.3" y="-861.8" font-family="Times,serif" font-size="14.00">[<]</text> +</g> +<!-- 27 --> +<g id="node14" class="node"><title>27</title> +<ellipse fill="none" stroke="black" cx="4018.3" cy="-192" rx="27" ry="18"/> +<text text-anchor="middle" x="4018.3" y="-188.3" font-family="Times,serif" font-size="14.00">27</text> +</g> +<!-- 1->27 --> +<g id="edge13" class="edge"><title>1->27</title> +<path fill="none" stroke="black" d="M1205.53,-907.928C1496.58,-907.07 4022.3,-897.481 4022.3,-823 4022.3,-823 4022.3,-823 4022.3,-321.5 4022.3,-279.944 4024.66,-269.488 4022.3,-228 4022.15,-225.435 4021.94,-222.77 4021.7,-220.107"/> +<polygon fill="black" stroke="black" points="4025.17,-219.633 4020.64,-210.056 4018.21,-220.369 4025.17,-219.633"/> +<text text-anchor="middle" x="4120.3" y="-536.3" font-family="Times,serif" font-size="14.00">[A-Z][_][a-b][e-f][h-k][m-o][q][t-z]</text> +</g> +<!-- 30 --> +<g id="node15" class="node"><title>30</title> +<ellipse fill="none" stroke="black" cx="4692.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="4692.3" y="-536.3" font-family="Times,serif" font-size="14.00">30</text> +</g> +<!-- 1->30 --> +<g id="edge14" class="edge"><title>1->30</title> +<path fill="none" stroke="black" d="M1205.28,-907.899C1483.81,-906.83 3830.81,-897.135 4139.3,-873 4293.32,-860.949 4483.3,-977.495 4483.3,-823 4483.3,-823 4483.3,-823 4483.3,-626 4483.3,-552.835 4594.56,-541.186 4654.72,-540.235"/> +<polygon fill="black" stroke="black" points="4655,-543.734 4664.97,-540.169 4654.95,-536.734 4655,-543.734"/> +<text text-anchor="middle" x="4491.3" y="-731.3" font-family="Times,serif" font-size="14.00">[c]</text> +</g> +<!-- 31 --> +<g id="node16" class="node"><title>31</title> +<ellipse fill="none" stroke="black" cx="1710.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="1710.3" y="-449.3" font-family="Times,serif" font-size="14.00">31</text> +</g> +<!-- 1->31 --> +<g id="edge15" class="edge"><title>1->31</title> +<path fill="none" stroke="black" d="M1205.07,-906.11C1305.95,-898.639 1657.3,-869.294 1657.3,-823 1657.3,-823 1657.3,-823 1657.3,-539 1657.3,-514.713 1673.07,-491.628 1687.41,-475.662"/> +<polygon fill="black" stroke="black" points="1690.34,-477.657 1694.68,-467.993 1685.26,-472.839 1690.34,-477.657"/> +<text text-anchor="middle" x="1665.3" y="-677.3" font-family="Times,serif" font-size="14.00">[d]</text> +</g> +<!-- 32 --> +<g id="node17" class="node"><title>32</title> +<ellipse fill="none" stroke="black" cx="1512.3" cy="-822" rx="27" ry="18"/> +<text text-anchor="middle" x="1512.3" y="-818.3" font-family="Times,serif" font-size="14.00">32</text> +</g> +<!-- 1->32 --> +<g id="edge16" class="edge"><title>1->32</title> +<path fill="none" stroke="black" d="M1203.13,-901.681C1261.94,-886.713 1409.87,-849.066 1477.54,-831.846"/> +<polygon fill="black" stroke="black" points="1478.47,-835.219 1487.3,-829.361 1476.75,-828.435 1478.47,-835.219"/> +<text text-anchor="middle" x="1373.3" y="-861.8" font-family="Times,serif" font-size="14.00">[g]</text> +</g> +<!-- 33 --> +<g id="node18" class="node"><title>33</title> +<ellipse fill="none" stroke="black" cx="5282.3" cy="-627" rx="27" ry="18"/> +<text text-anchor="middle" x="5282.3" y="-623.3" font-family="Times,serif" font-size="14.00">33</text> +</g> +<!-- 1->33 --> +<g id="edge17" class="edge"><title>1->33</title> +<path fill="none" stroke="black" d="M1205.44,-907.941C1512.55,-907.249 4325.11,-900.175 4497.3,-873 4799.56,-825.296 5145.96,-685.73 5250.7,-641.565"/> +<polygon fill="black" stroke="black" points="5252.23,-644.718 5260.08,-637.595 5249.5,-638.273 5252.23,-644.718"/> +<text text-anchor="middle" x="4904.8" y="-774.8" font-family="Times,serif" font-size="14.00">[l]</text> +</g> +<!-- 34 --> +<g id="node19" class="node"><title>34</title> +<ellipse fill="none" stroke="black" cx="2838.3" cy="-627" rx="27" ry="18"/> +<text text-anchor="middle" x="2838.3" y="-623.3" font-family="Times,serif" font-size="14.00">34</text> +</g> +<!-- 1->34 --> +<g id="edge18" class="edge"><title>1->34</title> +<path fill="none" stroke="black" d="M1205.42,-907.369C1280.07,-905.354 1494.75,-897.682 1671.3,-873 2123.84,-809.731 2663.57,-673.429 2803.71,-637.069"/> +<polygon fill="black" stroke="black" points="2804.67,-640.434 2813.47,-634.53 2802.91,-633.66 2804.67,-640.434"/> +<text text-anchor="middle" x="2235.3" y="-774.8" font-family="Times,serif" font-size="14.00">[p]</text> +</g> +<!-- 35 --> +<g id="node20" class="node"><title>35</title> +<ellipse fill="none" stroke="black" cx="4380.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="4380.3" y="-536.3" font-family="Times,serif" font-size="14.00">35</text> +</g> +<!-- 1->35 --> +<g id="edge19" class="edge"><title>1->35</title> +<path fill="none" stroke="black" d="M1205.63,-908.077C1480.46,-908.797 3740.86,-913.457 4036.3,-873 4121.96,-861.27 4224.3,-909.46 4224.3,-823 4224.3,-823 4224.3,-823 4224.3,-626 4224.3,-571.949 4297.4,-552.068 4343.52,-544.903"/> +<polygon fill="black" stroke="black" points="4344.07,-548.36 4353.48,-543.486 4343.08,-541.43 4344.07,-548.36"/> +<text text-anchor="middle" x="4231.3" y="-731.3" font-family="Times,serif" font-size="14.00">[r]</text> +</g> +<!-- 36 --> +<g id="node21" class="node"><title>36</title> +<ellipse fill="none" stroke="black" cx="6491.3" cy="-627" rx="27" ry="18"/> +<text text-anchor="middle" x="6491.3" y="-623.3" font-family="Times,serif" font-size="14.00">36</text> +</g> +<!-- 1->36 --> +<g id="edge20" class="edge"><title>1->36</title> +<path fill="none" stroke="black" d="M1205.65,-907.908C1506.63,-906.875 4196.57,-897.001 4549.3,-873 5323.74,-820.304 6262.28,-666.589 6455.5,-634.082"/> +<polygon fill="black" stroke="black" points="6456.13,-637.527 6465.41,-632.413 6454.96,-630.624 6456.13,-637.527"/> +<text text-anchor="middle" x="5537.8" y="-774.8" font-family="Times,serif" font-size="14.00">[s]</text> +</g> +<!-- 3 --> +<g id="node22" class="node"><title>3</title> +<ellipse fill="none" stroke="black" cx="53.2953" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="53.2953" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:233</text> +</g> +<!-- 2->3 --> +<g id="edge21" class="edge"><title>2->3</title> +<path fill="none" stroke="black" d="M75.7634,-804.207C71.8771,-792.409 66.5963,-776.378 62.1308,-762.822"/> +<polygon fill="black" stroke="black" points="65.3646,-761.452 58.9115,-753.049 58.716,-763.642 65.3646,-761.452"/> +</g> +<!-- 5 --> +<g id="node23" class="node"><title>5</title> +<ellipse fill="none" stroke="black" cx="178.295" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="178.295" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:239</text> +</g> +<!-- 4->5 --> +<g id="edge22" class="edge"><title>4->5</title> +<path fill="none" stroke="black" d="M203.171,-804.207C198.868,-792.409 193.021,-776.378 188.077,-762.822"/> +<polygon fill="black" stroke="black" points="191.228,-761.245 184.513,-753.049 184.651,-763.643 191.228,-761.245"/> +</g> +<!-- 7 --> +<g id="node24" class="node"><title>7</title> +<ellipse fill="none" stroke="black" cx="276.295" cy="-735" rx="27" ry="18"/> +<text text-anchor="middle" x="276.295" y="-731.3" font-family="Times,serif" font-size="14.00">7</text> +</g> +<!-- 6->7 --> +<g id="edge23" class="edge"><title>6->7</title> +<path fill="none" stroke="black" d="M299.622,-804.987C296.36,-799.15 292.893,-792.407 290.295,-786 287.315,-778.649 284.729,-770.443 282.619,-762.839"/> +<polygon fill="black" stroke="black" points="285.957,-761.771 280.044,-752.98 279.185,-763.54 285.957,-761.771"/> +</g> +<!-- 10 --> +<g id="node26" class="node"><title>10</title> +<ellipse fill="none" stroke="black" cx="374.295" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="374.295" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:226</text> +</g> +<!-- 9->10 --> +<g id="edge26" class="edge"><title>9->10</title> +<path fill="none" stroke="black" d="M405.776,-804.611C400.29,-792.655 392.738,-776.196 386.407,-762.397"/> +<polygon fill="black" stroke="black" points="389.41,-760.55 382.059,-752.92 383.048,-763.469 389.41,-760.55"/> +</g> +<!-- 12 --> +<g id="node27" class="node"><title>12</title> +<ellipse fill="none" stroke="black" cx="499.295" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="499.295" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:137</text> +</g> +<!-- 11->12 --> +<g id="edge27" class="edge"><title>11->12</title> +<path fill="none" stroke="black" d="M538.267,-805.012C531.361,-792.783 521.701,-775.677 513.727,-761.556"/> +<polygon fill="black" stroke="black" points="516.741,-759.775 508.776,-752.789 510.645,-763.217 516.741,-759.775"/> +</g> +<!-- 14 --> +<g id="node28" class="node"><title>14</title> +<ellipse fill="none" stroke="black" cx="624.295" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="624.295" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:123</text> +</g> +<!-- 13->14 --> +<g id="edge28" class="edge"><title>13->14</title> +<path fill="none" stroke="black" d="M645.159,-804.207C641.55,-792.409 636.646,-776.378 632.5,-762.822"/> +<polygon fill="black" stroke="black" points="635.782,-761.588 629.51,-753.049 629.089,-763.636 635.782,-761.588"/> +</g> +<!-- 16 --> +<g id="node29" class="node"><title>16</title> +<ellipse fill="none" stroke="black" cx="749.295" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="749.295" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:109</text> +</g> +<!-- 15->16 --> +<g id="edge29" class="edge"><title>15->16</title> +<path fill="none" stroke="black" d="M774.171,-804.207C769.868,-792.409 764.021,-776.378 759.077,-762.822"/> +<polygon fill="black" stroke="black" points="762.228,-761.245 755.513,-753.049 755.651,-763.643 762.228,-761.245"/> +</g> +<!-- 18 --> +<g id="node30" class="node"><title>18</title> +<ellipse fill="none" stroke="black" cx="911.295" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="911.295" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:116</text> +</g> +<!-- 17->18 --> +<g id="edge30" class="edge"><title>17->18</title> +<path fill="none" stroke="black" d="M881.027,-803.862C880.354,-793.983 880.604,-781.483 884.295,-771 885.541,-767.462 887.295,-763.999 889.318,-760.712"/> +<polygon fill="black" stroke="black" points="892.218,-762.674 895.137,-752.489 886.504,-758.63 892.218,-762.674"/> +<text text-anchor="middle" x="931.295" y="-774.8" font-family="Times,serif" font-size="14.00">[0x00-/][1-0xFF]</text> +</g> +<!-- 37 --> +<g id="node31" class="node"><title>37</title> +<ellipse fill="none" stroke="black" cx="673.295" cy="-681" rx="27" ry="18"/> +<text text-anchor="middle" x="673.295" y="-677.3" font-family="Times,serif" font-size="14.00">37</text> +</g> +<!-- 17->37 --> +<g id="edge31" class="edge"><title>17->37</title> +<path fill="none" stroke="black" d="M873.162,-804.942C855.496,-777.172 820.1,-722.593 811.295,-717 770.591,-691.141 749.852,-714.815 704.295,-699 703.433,-698.701 702.566,-698.379 701.698,-698.038"/> +<polygon fill="black" stroke="black" points="703.064,-694.814 692.516,-693.824 700.145,-701.176 703.064,-694.814"/> +<text text-anchor="middle" x="868.295" y="-774.8" font-family="Times,serif" font-size="14.00">[0]</text> +</g> +<!-- 20 --> +<g id="node32" class="node"><title>20</title> +<ellipse fill="none" stroke="black" cx="1217.3" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="1217.3" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:130</text> +</g> +<!-- 19->20 --> +<g id="edge32" class="edge"><title>19->20</title> +<path fill="none" stroke="black" d="M1217.3,-803.799C1217.3,-792.163 1217.3,-776.548 1217.3,-763.237"/> +<polygon fill="black" stroke="black" points="1220.8,-763.175 1217.3,-753.175 1213.8,-763.175 1220.8,-763.175"/> +</g> +<!-- 22 --> +<g id="node33" class="node"><title>22</title> +<ellipse fill="none" stroke="black" cx="749.295" cy="-540" rx="48.9926" ry="18"/> +<text text-anchor="middle" x="749.295" y="-536.3" font-family="Times,serif" font-size="14.00">lexer.re:58</text> +</g> +<!-- 21->22 --> +<g id="edge33" class="edge"><title>21->22</title> +<path fill="none" stroke="black" d="M1038,-804.619C1022.52,-777.965 991.358,-727.15 973.295,-717 924.545,-689.604 760.397,-739.932 722.295,-699 688.846,-663.066 714.319,-601.626 733.391,-566.898"/> +<polygon fill="black" stroke="black" points="736.634,-568.275 738.546,-557.854 730.553,-564.809 736.634,-568.275"/> +<text text-anchor="middle" x="790.295" y="-677.3" font-family="Times,serif" font-size="14.00">[0x00-W][Y-w][y-0xFF]</text> +</g> +<!-- 38 --> +<g id="node34" class="node"><title>38</title> +<ellipse fill="none" stroke="black" cx="1047.3" cy="-735" rx="27" ry="18"/> +<text text-anchor="middle" x="1047.3" y="-731.3" font-family="Times,serif" font-size="14.00">38</text> +</g> +<!-- 21->38 --> +<g id="edge34" class="edge"><title>21->38</title> +<path fill="none" stroke="black" d="M1047.3,-803.799C1047.3,-792.163 1047.3,-776.548 1047.3,-763.237"/> +<polygon fill="black" stroke="black" points="1050.8,-763.175 1047.3,-753.175 1043.8,-763.175 1050.8,-763.175"/> +<text text-anchor="middle" x="1064.8" y="-774.8" font-family="Times,serif" font-size="14.00">[X][x]</text> +</g> +<!-- 24 --> +<g id="node35" class="node"><title>24</title> +<ellipse fill="none" stroke="black" cx="1119.3" cy="-735" rx="27" ry="18"/> +<text text-anchor="middle" x="1119.3" y="-731.3" font-family="Times,serif" font-size="14.00">24</text> +</g> +<!-- 23->24 --> +<g id="edge35" class="edge"><title>23->24</title> +<path fill="none" stroke="black" d="M1136.84,-804.579C1134.13,-798.818 1131.31,-792.229 1129.3,-786 1126.96,-778.787 1125.07,-770.805 1123.58,-763.375"/> +<polygon fill="black" stroke="black" points="1127,-762.583 1121.75,-753.376 1120.11,-763.843 1127,-762.583"/> +</g> +<!-- 26 --> +<g id="node36" class="node"><title>26</title> +<ellipse fill="none" stroke="black" cx="1342.3" cy="-735" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="1342.3" y="-731.3" font-family="Times,serif" font-size="14.00">lexer.re:198</text> +</g> +<!-- 25->26 --> +<g id="edge38" class="edge"><title>25->26</title> +<path fill="none" stroke="black" d="M1328.33,-803.748C1328.12,-794.053 1328.39,-781.772 1330.3,-771 1330.77,-768.306 1331.42,-765.539 1332.18,-762.799"/> +<polygon fill="black" stroke="black" points="1335.54,-763.756 1335.22,-753.166 1328.87,-761.643 1335.54,-763.756"/> +<text text-anchor="middle" x="1380.3" y="-774.8" font-family="Times,serif" font-size="14.00">[0x00-<][>-0xFF]</text> +</g> +<!-- 40 --> +<g id="node37" class="node"><title>40</title> +<ellipse fill="none" stroke="black" cx="1440.3" cy="-735" rx="27" ry="18"/> +<text text-anchor="middle" x="1440.3" y="-731.3" font-family="Times,serif" font-size="14.00">40</text> +</g> +<!-- 25->40 --> +<g id="edge39" class="edge"><title>25->40</title> +<path fill="none" stroke="black" d="M1356.12,-818.953C1379.2,-815.719 1411.63,-807.397 1430.3,-786 1435.78,-779.715 1438.58,-771.283 1439.93,-763.136"/> +<polygon fill="black" stroke="black" points="1443.42,-763.459 1440.96,-753.153 1436.45,-762.741 1443.42,-763.459"/> +<text text-anchor="middle" x="1447.3" y="-774.8" font-family="Times,serif" font-size="14.00">[=]</text> +</g> +<!-- 28 --> +<g id="node38" class="node"><title>28</title> +<ellipse fill="none" stroke="black" cx="3985.3" cy="-105" rx="27" ry="18"/> +<text text-anchor="middle" x="3985.3" y="-101.3" font-family="Times,serif" font-size="14.00">28</text> +</g> +<!-- 27->28 --> +<g id="edge40" class="edge"><title>27->28</title> +<path fill="none" stroke="black" d="M4008.62,-174.987C4005.36,-169.15 4001.89,-162.407 3999.3,-156 3996.31,-148.649 3993.73,-140.443 3991.62,-132.839"/> +<polygon fill="black" stroke="black" points="3994.96,-131.771 3989.04,-122.98 3988.18,-133.54 3994.96,-131.771"/> +</g> +<!-- 30->28 --> +<g id="edge43" class="edge"><title>30->28</title> +<path fill="none" stroke="black" d="M4692.3,-521.744C4692.3,-504.57 4692.3,-477.464 4692.3,-454 4692.3,-454 4692.3,-454 4692.3,-191 4692.3,-122.931 4169.02,-109.072 4022.83,-106.528"/> +<polygon fill="black" stroke="black" points="4022.63,-103.024 4012.58,-106.357 4022.52,-110.023 4022.63,-103.024"/> +<text text-anchor="middle" x="4739.3" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-`][b-0xFF]</text> +</g> +<!-- 42 --> +<g id="node40" class="node"><title>42</title> +<ellipse fill="none" stroke="black" cx="4860.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="4860.3" y="-449.3" font-family="Times,serif" font-size="14.00">42</text> +</g> +<!-- 30->42 --> +<g id="edge44" class="edge"><title>30->42</title> +<path fill="none" stroke="black" d="M4713.23,-528.407C4742.74,-513.477 4796.71,-486.17 4830.42,-469.113"/> +<polygon fill="black" stroke="black" points="4832.02,-472.231 4839.36,-464.593 4828.86,-465.985 4832.02,-472.231"/> +<text text-anchor="middle" x="4794.3" y="-492.8" font-family="Times,serif" font-size="14.00">[a]</text> +</g> +<!-- 31->28 --> +<g id="edge45" class="edge"><title>31->28</title> +<path fill="none" stroke="black" d="M1708.17,-434.885C1703.39,-393.686 1693.46,-290.241 1710.3,-261 1718.24,-247.193 1729.28,-253.462 1741.3,-243 1770.66,-217.428 1766.32,-200.022 1795.3,-174 1815.94,-155.458 1821.68,-148.845 1848.3,-141 1953,-110.136 3671.42,-106.44 3947.89,-106.044"/> +<polygon fill="black" stroke="black" points="3948.19,-109.544 3958.19,-106.03 3948.18,-102.544 3948.19,-109.544"/> +<text text-anchor="middle" x="1757.3" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-t][v-0xFF]</text> +</g> +<!-- 43 --> +<g id="node41" class="node"><title>43</title> +<ellipse fill="none" stroke="black" cx="1832.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="1832.3" y="-362.3" font-family="Times,serif" font-size="14.00">43</text> +</g> +<!-- 31->43 --> +<g id="edge46" class="edge"><title>31->43</title> +<path fill="none" stroke="black" d="M1728.3,-439.458C1748.75,-425.208 1782.33,-401.815 1805.78,-385.476"/> +<polygon fill="black" stroke="black" points="1808.02,-388.182 1814.22,-379.593 1804.01,-382.438 1808.02,-388.182"/> +<text text-anchor="middle" x="1787.3" y="-405.8" font-family="Times,serif" font-size="14.00">[u]</text> +</g> +<!-- 32->28 --> +<g id="edge47" class="edge"><title>32->28</title> +<path fill="none" stroke="black" d="M1528.2,-807.408C1544.45,-791.929 1567.3,-765.002 1567.3,-736 1567.3,-736 1567.3,-736 1567.3,-408.5 1567.3,-304.269 1495.63,-252.412 1564.3,-174 1637.55,-90.3493 1701.41,-149.243 1812.3,-141 2251.63,-108.343 3697.59,-106.142 3948.14,-106.007"/> +<polygon fill="black" stroke="black" points="3948.19,-109.507 3958.19,-106.002 3948.18,-102.507 3948.19,-109.507"/> +<text text-anchor="middle" x="1615.8" y="-449.3" font-family="Times,serif" font-size="14.00">[0x00-n][p-0xFF]</text> +</g> +<!-- 44 --> +<g id="node42" class="node"><title>44</title> +<ellipse fill="none" stroke="black" cx="1512.3" cy="-735" rx="27" ry="18"/> +<text text-anchor="middle" x="1512.3" y="-731.3" font-family="Times,serif" font-size="14.00">44</text> +</g> +<!-- 32->44 --> +<g id="edge48" class="edge"><title>32->44</title> +<path fill="none" stroke="black" d="M1512.3,-803.799C1512.3,-792.163 1512.3,-776.548 1512.3,-763.237"/> +<polygon fill="black" stroke="black" points="1515.8,-763.175 1512.3,-753.175 1508.8,-763.175 1515.8,-763.175"/> +<text text-anchor="middle" x="1520.3" y="-774.8" font-family="Times,serif" font-size="14.00">[o]</text> +</g> +<!-- 33->28 --> +<g id="edge49" class="edge"><title>33->28</title> +<path fill="none" stroke="black" d="M5258.06,-618.871C5226.22,-607.838 5174.3,-583.353 5174.3,-541 5174.3,-541 5174.3,-541 5174.3,-191 5174.3,-167.746 5150.58,-164.918 4917.3,-141 4571.01,-105.496 4149.06,-104.94 4022.73,-105.673"/> +<polygon fill="black" stroke="black" points="4022.43,-102.175 4012.45,-105.74 4022.47,-109.175 4022.43,-102.175"/> +<text text-anchor="middle" x="5234.8" y="-362.3" font-family="Times,serif" font-size="14.00">[0x00-`][b-n][p-0xFF]</text> +</g> +<!-- 46 --> +<g id="node43" class="node"><title>46</title> +<ellipse fill="none" stroke="black" cx="5573.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="5573.3" y="-536.3" font-family="Times,serif" font-size="14.00">46</text> +</g> +<!-- 33->46 --> +<g id="edge50" class="edge"><title>33->46</title> +<path fill="none" stroke="black" d="M5306.61,-618.899C5358.39,-603.774 5479.68,-568.345 5539.17,-550.968"/> +<polygon fill="black" stroke="black" points="5540.23,-554.304 5548.85,-548.14 5538.27,-547.585 5540.23,-554.304"/> +<text text-anchor="middle" x="5452.3" y="-579.8" font-family="Times,serif" font-size="14.00">[a]</text> +</g> +<!-- 47 --> +<g id="node44" class="node"><title>47</title> +<ellipse fill="none" stroke="black" cx="5982.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="5982.3" y="-449.3" font-family="Times,serif" font-size="14.00">47</text> +</g> +<!-- 33->47 --> +<g id="edge51" class="edge"><title>33->47</title> +<path fill="none" stroke="black" d="M5307.97,-621.345C5343.26,-614.882 5408.72,-602.665 5464.3,-591 5528.98,-577.424 5545.22,-574.213 5609.3,-558 5734.88,-526.222 5882.73,-483.36 5948.18,-464.105"/> +<polygon fill="black" stroke="black" points="5949.36,-467.407 5957.96,-461.222 5947.38,-460.692 5949.36,-467.407"/> +<text text-anchor="middle" x="5748.3" y="-536.3" font-family="Times,serif" font-size="14.00">[o]</text> +</g> +<!-- 34->28 --> +<g id="edge52" class="edge"><title>34->28</title> +<path fill="none" stroke="black" d="M2811.23,-625.003C2657.44,-619.16 1900.3,-588.01 1900.3,-541 1900.3,-541 1900.3,-541 1900.3,-191 1900.3,-148.465 1817.43,-167.637 2162.3,-141 2527.54,-112.789 3722.48,-106.98 3948.3,-106.126"/> +<polygon fill="black" stroke="black" points="3948.32,-109.626 3958.31,-106.089 3948.3,-102.626 3948.32,-109.626"/> +<text text-anchor="middle" x="1973.3" y="-362.3" font-family="Times,serif" font-size="14.00">[0x00-n][p-q][s-t][v-0xFF]</text> +</g> +<!-- 48 --> +<g id="node45" class="node"><title>48</title> +<ellipse fill="none" stroke="black" cx="2838.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="2838.3" y="-362.3" font-family="Times,serif" font-size="14.00">48</text> +</g> +<!-- 34->48 --> +<g id="edge53" class="edge"><title>34->48</title> +<path fill="none" stroke="black" d="M2838.3,-608.604C2838.3,-564.462 2838.3,-447.829 2838.3,-394.415"/> +<polygon fill="black" stroke="black" points="2841.8,-394.32 2838.3,-384.32 2834.8,-394.32 2841.8,-394.32"/> +<text text-anchor="middle" x="2846.3" y="-492.8" font-family="Times,serif" font-size="14.00">[o]</text> +</g> +<!-- 49 --> +<g id="node46" class="node"><title>49</title> +<ellipse fill="none" stroke="black" cx="2223.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="2223.3" y="-536.3" font-family="Times,serif" font-size="14.00">49</text> +</g> +<!-- 34->49 --> +<g id="edge54" class="edge"><title>34->49</title> +<path fill="none" stroke="black" d="M2811.87,-622.348C2714.09,-608.834 2372.67,-561.645 2259.81,-546.047"/> +<polygon fill="black" stroke="black" points="2260.01,-542.541 2249.62,-544.639 2259.05,-549.475 2260.01,-542.541"/> +<text text-anchor="middle" x="2575.3" y="-579.8" font-family="Times,serif" font-size="14.00">[r]</text> +</g> +<!-- 50 --> +<g id="node47" class="node"><title>50</title> +<ellipse fill="none" stroke="black" cx="3260.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="3260.3" y="-449.3" font-family="Times,serif" font-size="14.00">50</text> +</g> +<!-- 34->50 --> +<g id="edge55" class="edge"><title>34->50</title> +<path fill="none" stroke="black" d="M2860.69,-616.874C2930.85,-588.277 3146.62,-500.334 3228.41,-466.996"/> +<polygon fill="black" stroke="black" points="3229.76,-470.224 3237.7,-463.208 3227.12,-463.742 3229.76,-470.224"/> +<text text-anchor="middle" x="3099.3" y="-536.3" font-family="Times,serif" font-size="14.00">[u]</text> +</g> +<!-- 35->28 --> +<g id="edge56" class="edge"><title>35->28</title> +<path fill="none" stroke="black" d="M4395.6,-524.924C4447.24,-476.681 4610.13,-317.86 4580.3,-261 4576.34,-253.468 4462.05,-177.491 4454.3,-174 4398.36,-148.829 4380.72,-151.545 4320.3,-141 4213.02,-122.278 4084.54,-112.273 4022.48,-108.21"/> +<polygon fill="black" stroke="black" points="4022.59,-104.711 4012.39,-107.564 4022.15,-111.696 4022.59,-104.711"/> +<text text-anchor="middle" x="4620.3" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-d][f-0xFF]</text> +</g> +<!-- 51 --> +<g id="node48" class="node"><title>51</title> +<ellipse fill="none" stroke="black" cx="4380.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="4380.3" y="-449.3" font-family="Times,serif" font-size="14.00">51</text> +</g> +<!-- 35->51 --> +<g id="edge57" class="edge"><title>35->51</title> +<path fill="none" stroke="black" d="M4380.3,-521.799C4380.3,-510.163 4380.3,-494.548 4380.3,-481.237"/> +<polygon fill="black" stroke="black" points="4383.8,-481.175 4380.3,-471.175 4376.8,-481.175 4383.8,-481.175"/> +<text text-anchor="middle" x="4388.3" y="-492.8" font-family="Times,serif" font-size="14.00">[e]</text> +</g> +<!-- 36->28 --> +<g id="edge58" class="edge"><title>36->28</title> +<path fill="none" stroke="black" d="M6517.94,-623.115C6561.29,-616.784 6642.3,-597.406 6642.3,-541 6642.3,-541 6642.3,-541 6642.3,-191 6642.3,-83.3481 6512.28,-152.945 6405.3,-141 6158.95,-113.495 4310.69,-106.959 4022.91,-106.104"/> +<polygon fill="black" stroke="black" points="4022.6,-102.603 4012.59,-106.074 4022.58,-109.603 4022.6,-102.603"/> +<text text-anchor="middle" x="6689.8" y="-362.3" font-family="Times,serif" font-size="14.00">[0x00-s][u-0xFF]</text> +</g> +<!-- 52 --> +<g id="node49" class="node"><title>52</title> +<ellipse fill="none" stroke="black" cx="6491.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="6491.3" y="-536.3" font-family="Times,serif" font-size="14.00">52</text> +</g> +<!-- 36->52 --> +<g id="edge59" class="edge"><title>36->52</title> +<path fill="none" stroke="black" d="M6491.3,-608.799C6491.3,-597.163 6491.3,-581.548 6491.3,-568.237"/> +<polygon fill="black" stroke="black" points="6494.8,-568.175 6491.3,-558.175 6487.8,-568.175 6494.8,-568.175"/> +<text text-anchor="middle" x="6497.8" y="-579.8" font-family="Times,serif" font-size="14.00">[t]</text> +</g> +<!-- 7->6 --> +<g id="edge25" class="edge"><title>7->6</title> +<path fill="none" stroke="black" d="M282.801,-752.758C287.454,-764.741 293.806,-781.104 299.125,-794.803"/> +<polygon fill="black" stroke="black" points="295.894,-796.151 302.776,-804.207 302.419,-793.618 295.894,-796.151"/> +<text text-anchor="middle" x="319.795" y="-774.8" font-family="Times,serif" font-size="14.00">[0x09][ ]</text> +</g> +<!-- 8 --> +<g id="node25" class="node"><title>8</title> +<ellipse fill="none" stroke="black" cx="276.295" cy="-627" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="276.295" y="-623.3" font-family="Times,serif" font-size="14.00">lexer.re:220</text> +</g> +<!-- 7->8 --> +<g id="edge24" class="edge"><title>7->8</title> +<path fill="none" stroke="black" d="M276.295,-716.969C276.295,-700.378 276.295,-674.883 276.295,-655.431"/> +<polygon fill="black" stroke="black" points="279.795,-655.341 276.295,-645.341 272.795,-655.341 279.795,-655.341"/> +<text text-anchor="middle" x="369.295" y="-677.3" font-family="Times,serif" font-size="14.00">[0x00-0x08][0x0A-0x1F][!-0xFF]</text> +</g> +<!-- 37->22 --> +<g id="edge60" class="edge"><title>37->22</title> +<path fill="none" stroke="black" d="M676.372,-662.939C680.883,-641.274 690.833,-603.418 709.295,-576 712.388,-571.408 716.228,-567.045 720.295,-563.057"/> +<polygon fill="black" stroke="black" points="722.681,-565.619 727.75,-556.315 717.985,-560.427 722.681,-565.619"/> +</g> +<!-- 39 --> +<g id="node50" class="node"><title>39</title> +<ellipse fill="none" stroke="black" cx="830.295" cy="-627" rx="27" ry="18"/> +<text text-anchor="middle" x="830.295" y="-623.3" font-family="Times,serif" font-size="14.00">39</text> +</g> +<!-- 38->39 --> +<g id="edge61" class="edge"><title>38->39</title> +<path fill="none" stroke="black" d="M1025.5,-723.869C1019.39,-721.331 1012.67,-718.816 1006.3,-717 958.653,-703.423 939.958,-722.403 896.295,-699 890.526,-695.908 867.397,-670.355 850.136,-650.781"/> +<polygon fill="black" stroke="black" points="852.625,-648.311 843.397,-643.106 847.364,-652.93 852.625,-648.311"/> +<text text-anchor="middle" x="971.795" y="-677.3" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][G-`][g-0xFF]</text> +</g> +<!-- 53 --> +<g id="node51" class="node"><title>53</title> +<ellipse fill="none" stroke="black" cx="1056.3" cy="-627" rx="27" ry="18"/> +<text text-anchor="middle" x="1056.3" y="-623.3" font-family="Times,serif" font-size="14.00">53</text> +</g> +<!-- 38->53 --> +<g id="edge62" class="edge"><title>38->53</title> +<path fill="none" stroke="black" d="M1048.74,-716.969C1050.16,-700.279 1052.34,-674.579 1054,-655.084"/> +<polygon fill="black" stroke="black" points="1057.49,-655.249 1054.85,-644.988 1050.52,-654.656 1057.49,-655.249"/> +<text text-anchor="middle" x="1094.3" y="-677.3" font-family="Times,serif" font-size="14.00">[0-9][A-F][a-f]</text> +</g> +<!-- 24->23 --> +<g id="edge37" class="edge"><title>24->23</title> +<path fill="none" stroke="black" d="M1124.42,-752.758C1128.05,-764.625 1132.99,-780.787 1137.16,-794.403"/> +<polygon fill="black" stroke="black" points="1133.89,-795.668 1140.16,-804.207 1140.58,-793.62 1133.89,-795.668"/> +<text text-anchor="middle" x="1148.3" y="-774.8" font-family="Times,serif" font-size="14.00">[0-9]</text> +</g> +<!-- 24->22 --> +<g id="edge36" class="edge"><title>24->22</title> +<path fill="none" stroke="black" d="M1131.08,-718.494C1141.59,-702.656 1153.32,-678.283 1139.3,-663 1107.62,-628.495 973.975,-659.052 929.295,-645 927.311,-644.376 834.766,-590.675 783.172,-560.696"/> +<polygon fill="black" stroke="black" points="784.755,-557.568 774.351,-555.569 781.238,-563.62 784.755,-557.568"/> +<text text-anchor="middle" x="974.795" y="-623.3" font-family="Times,serif" font-size="14.00">[0x00-/][:-0xFF]</text> +</g> +<!-- 41 --> +<g id="node52" class="node"><title>41</title> +<ellipse fill="none" stroke="black" cx="1154.3" cy="-627" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="1154.3" y="-623.3" font-family="Times,serif" font-size="14.00">lexer.re:192</text> +</g> +<!-- 40->41 --> +<g id="edge64" class="edge"><title>40->41</title> +<path fill="none" stroke="black" d="M1419.82,-722.872C1414.86,-720.591 1409.49,-718.448 1404.3,-717 1328.98,-696.006 1300.36,-731.612 1229.3,-699 1206.81,-688.683 1186.78,-668.868 1173.09,-652.787"/> +<polygon fill="black" stroke="black" points="1175.58,-650.299 1166.53,-644.788 1170.16,-654.739 1175.58,-650.299"/> +</g> +<!-- 28->27 --> +<g id="edge42" class="edge"><title>28->27</title> +<path fill="none" stroke="black" d="M3991.8,-122.758C3996.45,-134.741 4002.81,-151.104 4008.12,-164.803"/> +<polygon fill="black" stroke="black" points="4004.89,-166.151 4011.78,-174.207 4011.42,-163.618 4004.89,-166.151"/> +<text text-anchor="middle" x="4054.3" y="-144.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 29 --> +<g id="node39" class="node"><title>29</title> +<ellipse fill="none" stroke="black" cx="3985.3" cy="-18" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="3985.3" y="-14.3" font-family="Times,serif" font-size="14.00">lexer.re:212</text> +</g> +<!-- 28->29 --> +<g id="edge41" class="edge"><title>28->29</title> +<path fill="none" stroke="black" d="M3985.3,-86.799C3985.3,-75.1626 3985.3,-59.5479 3985.3,-46.2368"/> +<polygon fill="black" stroke="black" points="3988.8,-46.1754 3985.3,-36.1754 3981.8,-46.1755 3988.8,-46.1754"/> +<text text-anchor="middle" x="4066.3" y="-57.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 42->28 --> +<g id="edge65" class="edge"><title>42->28</title> +<path fill="none" stroke="black" d="M4871.58,-436.538C4899.19,-399.896 4974.14,-307.382 5059.3,-261 5091.63,-243.387 5158.15,-256.872 5135.3,-228 5030.71,-95.8896 4933.19,-164.206 4766.3,-141 4620.03,-120.661 4158.11,-109.61 4022.86,-106.753"/> +<polygon fill="black" stroke="black" points="4022.67,-103.249 4012.6,-106.539 4022.52,-110.247 4022.67,-103.249"/> +<text text-anchor="middle" x="5109.8" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-k][m-0xFF]</text> +</g> +<!-- 56 --> +<g id="node53" class="node"><title>56</title> +<ellipse fill="none" stroke="black" cx="4860.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="4860.3" y="-362.3" font-family="Times,serif" font-size="14.00">56</text> +</g> +<!-- 42->56 --> +<g id="edge66" class="edge"><title>42->56</title> +<path fill="none" stroke="black" d="M4860.3,-434.799C4860.3,-423.163 4860.3,-407.548 4860.3,-394.237"/> +<polygon fill="black" stroke="black" points="4863.8,-394.175 4860.3,-384.175 4856.8,-394.175 4863.8,-394.175"/> +<text text-anchor="middle" x="4866.8" y="-405.8" font-family="Times,serif" font-size="14.00">[l]</text> +</g> +<!-- 43->28 --> +<g id="edge67" class="edge"><title>43->28</title> +<path fill="none" stroke="black" d="M1831.35,-347.692C1829.51,-326.102 1824.12,-288.665 1808.3,-261 1802.52,-250.903 1793.89,-253.686 1789.3,-243 1786.66,-236.876 1786.58,-234.088 1789.3,-228 1812.9,-175.119 1832.39,-162.151 1886.3,-141 1986.06,-101.859 3674.74,-105.098 3948.07,-105.881"/> +<polygon fill="black" stroke="black" points="3948.24,-109.381 3958.26,-105.911 3948.27,-102.381 3948.24,-109.381"/> +<text text-anchor="middle" x="1837.8" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-o][q-0xFF]</text> +</g> +<!-- 57 --> +<g id="node54" class="node"><title>57</title> +<ellipse fill="none" stroke="black" cx="2319.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="2319.3" y="-275.3" font-family="Times,serif" font-size="14.00">57</text> +</g> +<!-- 43->57 --> +<g id="edge68" class="edge"><title>43->57</title> +<path fill="none" stroke="black" d="M1854.98,-355.769C1862.33,-353.006 1870.58,-350.144 1878.3,-348 1953.71,-327.028 1973.8,-326.056 2051.3,-315 2134.83,-303.082 2156.91,-309.898 2240.3,-297 2254.77,-294.761 2270.57,-291.522 2284.22,-288.47"/> +<polygon fill="black" stroke="black" points="2285.21,-291.834 2294.17,-286.192 2283.65,-285.01 2285.21,-291.834"/> +<text text-anchor="middle" x="2059.3" y="-318.8" font-family="Times,serif" font-size="14.00">[p]</text> +</g> +<!-- 44->27 --> +<g id="edge70" class="edge"><title>44->27</title> +<path fill="none" stroke="black" d="M1539.27,-733.506C1798.71,-728.673 3842.3,-688.677 3842.3,-628 3842.3,-628 3842.3,-628 3842.3,-495.5 3842.3,-362.166 3944.52,-362.185 4004.3,-243 4007.85,-235.909 4010.62,-227.785 4012.72,-220.176"/> +<polygon fill="black" stroke="black" points="4016.16,-220.813 4015.17,-210.264 4009.37,-219.127 4016.16,-220.813"/> +<text text-anchor="middle" x="3927.3" y="-449.3" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-e][g-s][u-z]</text> +</g> +<!-- 45 --> +<g id="node55" class="node"><title>45</title> +<ellipse fill="none" stroke="black" cx="1399.3" cy="-627" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="1399.3" y="-623.3" font-family="Times,serif" font-size="14.00">lexer.re:158</text> +</g> +<!-- 44->45 --> +<g id="edge69" class="edge"><title>44->45</title> +<path fill="none" stroke="black" d="M1491.69,-723.269C1486.74,-720.972 1481.4,-718.721 1476.3,-717 1439.7,-704.672 1415.61,-729.001 1391.3,-699 1381.33,-686.707 1383.28,-669.036 1387.75,-654.399"/> +<polygon fill="black" stroke="black" points="1391.09,-655.449 1391.13,-644.854 1384.49,-653.113 1391.09,-655.449"/> +<text text-anchor="middle" x="1472.3" y="-677.3" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 59 --> +<g id="node56" class="node"><title>59</title> +<ellipse fill="none" stroke="black" cx="1301.3" cy="-627" rx="27" ry="18"/> +<text text-anchor="middle" x="1301.3" y="-623.3" font-family="Times,serif" font-size="14.00">59</text> +</g> +<!-- 44->59 --> +<g id="edge71" class="edge"><title>44->59</title> +<path fill="none" stroke="black" d="M1491.75,-723.096C1486.8,-720.806 1481.44,-718.602 1476.3,-717 1428.99,-702.28 1409.87,-722.569 1366.3,-699 1345.96,-687.998 1328.61,-668.145 1316.97,-652.225"/> +<polygon fill="black" stroke="black" points="1319.71,-650.042 1311.11,-643.866 1313.98,-654.062 1319.71,-650.042"/> +<text text-anchor="middle" x="1373.3" y="-677.3" font-family="Times,serif" font-size="14.00">[f]</text> +</g> +<!-- 60 --> +<g id="node57" class="node"><title>60</title> +<ellipse fill="none" stroke="black" cx="1159.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="1159.3" y="-536.3" font-family="Times,serif" font-size="14.00">60</text> +</g> +<!-- 44->60 --> +<g id="edge72" class="edge"><title>44->60</title> +<path fill="none" stroke="black" d="M1491.8,-722.924C1486.85,-720.641 1481.48,-718.484 1476.3,-717 1410.05,-698.038 1386.12,-724.989 1322.3,-699 1285.9,-684.181 1281.07,-671.758 1252.3,-645 1224.46,-619.111 1195.8,-585.876 1177.79,-564.033"/> +<polygon fill="black" stroke="black" points="1180.47,-561.784 1171.43,-556.258 1175.05,-566.215 1180.47,-561.784"/> +<text text-anchor="middle" x="1258.8" y="-623.3" font-family="Times,serif" font-size="14.00">[t]</text> +</g> +<!-- 46->28 --> +<g id="edge73" class="edge"><title>46->28</title> +<path fill="none" stroke="black" d="M5593.43,-527.849C5597.33,-525.821 5601.41,-523.785 5605.3,-522 5680.75,-487.354 5779.3,-537.029 5779.3,-454 5779.3,-454 5779.3,-454 5779.3,-191 5779.3,-99.7909 4280.21,-104.307 4022.72,-105.755"/> +<polygon fill="black" stroke="black" points="4022.38,-102.257 4012.4,-105.815 4022.42,-109.257 4022.38,-102.257"/> +<text text-anchor="middle" x="5826.8" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-a][c-0xFF]</text> +</g> +<!-- 61 --> +<g id="node58" class="node"><title>61</title> +<ellipse fill="none" stroke="black" cx="5573.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="5573.3" y="-449.3" font-family="Times,serif" font-size="14.00">61</text> +</g> +<!-- 46->61 --> +<g id="edge74" class="edge"><title>46->61</title> +<path fill="none" stroke="black" d="M5573.3,-521.799C5573.3,-510.163 5573.3,-494.548 5573.3,-481.237"/> +<polygon fill="black" stroke="black" points="5576.8,-481.175 5573.3,-471.175 5569.8,-481.175 5576.8,-481.175"/> +<text text-anchor="middle" x="5581.3" y="-492.8" font-family="Times,serif" font-size="14.00">[b]</text> +</g> +<!-- 47->28 --> +<g id="edge75" class="edge"><title>47->28</title> +<path fill="none" stroke="black" d="M6007.89,-446.696C6044.46,-437.449 6107.3,-414.632 6107.3,-367 6107.3,-367 6107.3,-367 6107.3,-191 6107.3,-78.1242 5970.51,-153.215 5858.3,-141 5483.73,-100.228 4252.92,-104.589 4022.6,-105.784"/> +<polygon fill="black" stroke="black" points="4022.38,-102.285 4012.4,-105.838 4022.42,-109.285 4022.38,-102.285"/> +<text text-anchor="middle" x="6154.3" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-`][b-0xFF]</text> +</g> +<!-- 62 --> +<g id="node59" class="node"><title>62</title> +<ellipse fill="none" stroke="black" cx="5982.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="5982.3" y="-362.3" font-family="Times,serif" font-size="14.00">62</text> +</g> +<!-- 47->62 --> +<g id="edge76" class="edge"><title>47->62</title> +<path fill="none" stroke="black" d="M5982.3,-434.799C5982.3,-423.163 5982.3,-407.548 5982.3,-394.237"/> +<polygon fill="black" stroke="black" points="5985.8,-394.175 5982.3,-384.175 5978.8,-394.175 5985.8,-394.175"/> +<text text-anchor="middle" x="5990.3" y="-405.8" font-family="Times,serif" font-size="14.00">[a]</text> +</g> +<!-- 48->28 --> +<g id="edge77" class="edge"><title>48->28</title> +<path fill="none" stroke="black" d="M2811.3,-364.442C2711.19,-361.472 2371.85,-342.895 2468.3,-228 2566.44,-111.087 3723.54,-105.835 3947.79,-105.92"/> +<polygon fill="black" stroke="black" points="3948.05,-109.42 3958.05,-105.928 3948.05,-102.42 3948.05,-109.42"/> +<text text-anchor="middle" x="2516.8" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-o][q-0xFF]</text> +</g> +<!-- 63 --> +<g id="node60" class="node"><title>63</title> +<ellipse fill="none" stroke="black" cx="3396.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="3396.3" y="-275.3" font-family="Times,serif" font-size="14.00">63</text> +</g> +<!-- 48->63 --> +<g id="edge78" class="edge"><title>48->63</title> +<path fill="none" stroke="black" d="M2865.14,-363.945C2942.5,-360.381 3172.1,-346.109 3355.3,-297 3358.67,-296.095 3362.14,-294.976 3365.56,-293.749"/> +<polygon fill="black" stroke="black" points="3366.91,-296.978 3374.96,-290.086 3364.37,-290.455 3366.91,-296.978"/> +<text text-anchor="middle" x="3281.3" y="-318.8" font-family="Times,serif" font-size="14.00">[p]</text> +</g> +<!-- 49->28 --> +<g id="edge79" class="edge"><title>49->28</title> +<path fill="none" stroke="black" d="M2197.46,-534.64C2158.52,-526.425 2089.3,-504.691 2089.3,-454 2089.3,-454 2089.3,-454 2086.3,-321.5 2086.3,-318.611 2085.72,-317.831 2086.3,-315 2099.9,-248.269 2101.37,-225.188 2146.3,-174 2165.35,-152.287 2174.5,-148.874 2202.3,-141 2289.16,-116.391 3698.3,-107.569 3947.72,-106.197"/> +<polygon fill="black" stroke="black" points="3948.08,-109.695 3958.06,-106.14 3948.04,-102.695 3948.08,-109.695"/> +<text text-anchor="middle" x="2136.3" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-h][j-0xFF]</text> +</g> +<!-- 65 --> +<g id="node61" class="node"><title>65</title> +<ellipse fill="none" stroke="black" cx="2223.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="2223.3" y="-449.3" font-family="Times,serif" font-size="14.00">65</text> +</g> +<!-- 49->65 --> +<g id="edge80" class="edge"><title>49->65</title> +<path fill="none" stroke="black" d="M2223.3,-521.799C2223.3,-510.163 2223.3,-494.548 2223.3,-481.237"/> +<polygon fill="black" stroke="black" points="2226.8,-481.175 2223.3,-471.175 2219.8,-481.175 2226.8,-481.175"/> +<text text-anchor="middle" x="2229.8" y="-492.8" font-family="Times,serif" font-size="14.00">[i]</text> +</g> +<!-- 50->28 --> +<g id="edge81" class="edge"><title>50->28</title> +<path fill="none" stroke="black" d="M3260.3,-434.744C3260.3,-417.57 3260.3,-390.464 3260.3,-367 3260.3,-367 3260.3,-367 3260.3,-191 3260.3,-121.068 3799.27,-108.539 3947.79,-106.414"/> +<polygon fill="black" stroke="black" points="3948.25,-109.908 3958.2,-106.273 3948.15,-102.908 3948.25,-109.908"/> +<text text-anchor="middle" x="3305.8" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-r][t-0xFF]</text> +</g> +<!-- 66 --> +<g id="node62" class="node"><title>66</title> +<ellipse fill="none" stroke="black" cx="3478.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="3478.3" y="-362.3" font-family="Times,serif" font-size="14.00">66</text> +</g> +<!-- 50->66 --> +<g id="edge82" class="edge"><title>50->66</title> +<path fill="none" stroke="black" d="M3283.21,-443.064C3322.14,-427.887 3401.27,-397.031 3445.87,-379.645"/> +<polygon fill="black" stroke="black" points="3447.31,-382.837 3455.36,-375.944 3444.77,-376.316 3447.31,-382.837"/> +<text text-anchor="middle" x="3390.8" y="-405.8" font-family="Times,serif" font-size="14.00">[s]</text> +</g> +<!-- 51->28 --> +<g id="edge83" class="edge"><title>51->28</title> +<path fill="none" stroke="black" d="M4389.69,-436.096C4393.11,-430.153 4396.97,-423.314 4400.3,-417 4407.9,-402.582 4409.99,-399.029 4416.3,-384 4438.77,-330.468 4422.56,-305.125 4460.3,-261 4471.15,-248.303 4484.77,-257.366 4493.3,-243 4496.7,-237.267 4497.09,-233.484 4493.3,-228 4438.95,-149.387 4129.85,-117.529 4022.23,-108.721"/> +<polygon fill="black" stroke="black" points="4022.42,-105.224 4012.17,-107.917 4021.86,-112.202 4022.42,-105.224"/> +<text text-anchor="middle" x="4520.3" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-`][b-s][u-0xFF]</text> +</g> +<!-- 67 --> +<g id="node63" class="node"><title>67</title> +<ellipse fill="none" stroke="black" cx="4380.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="4380.3" y="-362.3" font-family="Times,serif" font-size="14.00">67</text> +</g> +<!-- 51->67 --> +<g id="edge84" class="edge"><title>51->67</title> +<path fill="none" stroke="black" d="M4380.3,-434.799C4380.3,-423.163 4380.3,-407.548 4380.3,-394.237"/> +<polygon fill="black" stroke="black" points="4383.8,-394.175 4380.3,-384.175 4376.8,-394.175 4383.8,-394.175"/> +<text text-anchor="middle" x="4388.3" y="-405.8" font-family="Times,serif" font-size="14.00">[a]</text> +</g> +<!-- 68 --> +<g id="node64" class="node"><title>68</title> +<ellipse fill="none" stroke="black" cx="4184.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="4184.3" y="-362.3" font-family="Times,serif" font-size="14.00">68</text> +</g> +<!-- 51->68 --> +<g id="edge85" class="edge"><title>51->68</title> +<path fill="none" stroke="black" d="M4358.19,-442.415C4323.32,-427.293 4255.43,-397.848 4215.57,-380.563"/> +<polygon fill="black" stroke="black" points="4216.88,-377.318 4206.32,-376.55 4214.1,-383.74 4216.88,-377.318"/> +<text text-anchor="middle" x="4300.8" y="-405.8" font-family="Times,serif" font-size="14.00">[t]</text> +</g> +<!-- 52->28 --> +<g id="edge86" class="edge"><title>52->28</title> +<path fill="none" stroke="black" d="M6503.21,-523.674C6514.68,-507.354 6530.3,-480.303 6530.3,-454 6530.3,-454 6530.3,-454 6530.3,-191 6530.3,-68.5227 6381.17,-153.096 6259.3,-141 6028.11,-118.056 4299.98,-107.717 4022.76,-106.199"/> +<polygon fill="black" stroke="black" points="4022.46,-102.697 4012.44,-106.142 4022.42,-109.697 4022.46,-102.697"/> +<text text-anchor="middle" x="6578.8" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-n][p-0xFF]</text> +</g> +<!-- 70 --> +<g id="node65" class="node"><title>70</title> +<ellipse fill="none" stroke="black" cx="6407.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="6407.3" y="-449.3" font-family="Times,serif" font-size="14.00">70</text> +</g> +<!-- 52->70 --> +<g id="edge87" class="edge"><title>52->70</title> +<path fill="none" stroke="black" d="M6477.05,-524.581C6463.89,-511.271 6444.17,-491.309 6429.04,-476.007"/> +<polygon fill="black" stroke="black" points="6431.13,-473.142 6421.61,-468.49 6426.15,-478.063 6431.13,-473.142"/> +<text text-anchor="middle" x="6462.3" y="-492.8" font-family="Times,serif" font-size="14.00">[o]</text> +</g> +<!-- 39->22 --> +<g id="edge63" class="edge"><title>39->22</title> +<path fill="none" stroke="black" d="M816.186,-611.194C803.989,-598.395 786.136,-579.66 771.941,-564.764"/> +<polygon fill="black" stroke="black" points="774.333,-562.201 764.901,-557.376 769.266,-567.03 774.333,-562.201"/> +</g> +<!-- 54 --> +<g id="node66" class="node"><title>54</title> +<ellipse fill="none" stroke="black" cx="1023.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="1023.3" y="-536.3" font-family="Times,serif" font-size="14.00">54</text> +</g> +<!-- 53->54 --> +<g id="edge88" class="edge"><title>53->54</title> +<path fill="none" stroke="black" d="M1046.62,-609.987C1043.36,-604.15 1039.89,-597.407 1037.3,-591 1034.31,-583.649 1031.73,-575.443 1029.62,-567.839"/> +<polygon fill="black" stroke="black" points="1032.96,-566.771 1027.04,-557.98 1026.18,-568.54 1032.96,-566.771"/> +</g> +<!-- 56->28 --> +<g id="edge91" class="edge"><title>56->28</title> +<path fill="none" stroke="black" d="M4869.48,-348.825C4883.1,-322.606 4905.29,-269.573 4888.3,-228 4875.57,-196.872 4864.44,-190.785 4835.3,-174 4784.01,-144.462 4764.81,-149.813 4706.3,-141 4572.35,-120.828 4150.51,-109.767 4022.49,-106.813"/> +<polygon fill="black" stroke="black" points="4022.48,-103.312 4012.41,-106.583 4022.32,-110.31 4022.48,-103.312"/> +<text text-anchor="middle" x="4942.8" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-k][m-0xFF]</text> +</g> +<!-- 71 --> +<g id="node68" class="node"><title>71</title> +<ellipse fill="none" stroke="black" cx="4747.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="4747.3" y="-275.3" font-family="Times,serif" font-size="14.00">71</text> +</g> +<!-- 56->71 --> +<g id="edge92" class="edge"><title>56->71</title> +<path fill="none" stroke="black" d="M4843.13,-352.09C4824.38,-337.986 4794.16,-315.251 4772.67,-299.086"/> +<polygon fill="black" stroke="black" points="4774.71,-296.245 4764.62,-293.031 4770.51,-301.84 4774.71,-296.245"/> +<text text-anchor="middle" x="4816.8" y="-318.8" font-family="Times,serif" font-size="14.00">[l]</text> +</g> +<!-- 57->27 --> +<g id="edge94" class="edge"><title>57->27</title> +<path fill="none" stroke="black" d="M2346.28,-277.072C2468.92,-272.795 2969.2,-254.698 3000.3,-243 3010.37,-239.212 3009.17,-231.649 3019.3,-228 3058.87,-213.732 3734.27,-211.974 3776.3,-210 3849.05,-206.582 3933.93,-200.025 3981.36,-196.129"/> +<polygon fill="black" stroke="black" points="3981.78,-199.606 3991.46,-195.293 3981.21,-192.63 3981.78,-199.606"/> +<text text-anchor="middle" x="3069.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 58 --> +<g id="node69" class="node"><title>58</title> +<ellipse fill="none" stroke="black" cx="2286.3" cy="-192" rx="48.9926" ry="18"/> +<text text-anchor="middle" x="2286.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:88</text> +</g> +<!-- 57->58 --> +<g id="edge93" class="edge"><title>57->58</title> +<path fill="none" stroke="black" d="M2302.55,-264.379C2296.58,-258.497 2290.54,-251.104 2287.3,-243 2284.49,-235.986 2283.48,-227.965 2283.36,-220.431"/> +<polygon fill="black" stroke="black" points="2286.87,-220.372 2283.7,-210.261 2279.87,-220.138 2286.87,-220.372"/> +<text text-anchor="middle" x="2368.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 59->28 --> +<g id="edge95" class="edge"><title>59->28</title> +<path fill="none" stroke="black" d="M1292.51,-609.916C1272.35,-571.977 1223.21,-473.361 1206.3,-384 1197.45,-337.282 1218.58,-211.894 1247.3,-174 1265.44,-150.055 1277.27,-148.768 1306.3,-141 1439.72,-105.289 3632.44,-105.716 3947.67,-105.963"/> +<polygon fill="black" stroke="black" points="3948.08,-109.463 3958.08,-105.971 3948.09,-102.463 3948.08,-109.463"/> +<text text-anchor="middle" x="1253.3" y="-362.3" font-family="Times,serif" font-size="14.00">[0x00-`][b-0xFF]</text> +</g> +<!-- 73 --> +<g id="node70" class="node"><title>73</title> +<ellipse fill="none" stroke="black" cx="1328.3" cy="-540" rx="27" ry="18"/> +<text text-anchor="middle" x="1328.3" y="-536.3" font-family="Times,serif" font-size="14.00">73</text> +</g> +<!-- 59->73 --> +<g id="edge96" class="edge"><title>59->73</title> +<path fill="none" stroke="black" d="M1306.63,-609.207C1310.4,-597.332 1315.54,-581.168 1319.86,-567.557"/> +<polygon fill="black" stroke="black" points="1323.28,-568.349 1322.97,-557.758 1316.61,-566.229 1323.28,-568.349"/> +<text text-anchor="middle" x="1325.3" y="-579.8" font-family="Times,serif" font-size="14.00">[a]</text> +</g> +<!-- 60->28 --> +<g id="edge97" class="edge"><title>60->28</title> +<path fill="none" stroke="black" d="M1132.65,-536.115C1089.3,-529.784 1008.3,-510.406 1008.3,-454 1008.3,-454 1008.3,-454 1008.3,-191 1008.3,-113.097 1099.28,-152.708 1176.3,-141 1319.77,-119.189 3625.24,-107.678 3947.9,-106.17"/> +<polygon fill="black" stroke="black" points="3948.14,-109.669 3958.12,-106.123 3948.11,-102.67 3948.14,-109.669"/> +<text text-anchor="middle" x="1055.8" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-q][s-0xFF]</text> +</g> +<!-- 74 --> +<g id="node71" class="node"><title>74</title> +<ellipse fill="none" stroke="black" cx="1159.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="1159.3" y="-449.3" font-family="Times,serif" font-size="14.00">74</text> +</g> +<!-- 60->74 --> +<g id="edge98" class="edge"><title>60->74</title> +<path fill="none" stroke="black" d="M1159.3,-521.799C1159.3,-510.163 1159.3,-494.548 1159.3,-481.237"/> +<polygon fill="black" stroke="black" points="1162.8,-481.175 1159.3,-471.175 1155.8,-481.175 1162.8,-481.175"/> +<text text-anchor="middle" x="1166.3" y="-492.8" font-family="Times,serif" font-size="14.00">[r]</text> +</g> +<!-- 61->28 --> +<g id="edge99" class="edge"><title>61->28</title> +<path fill="none" stroke="black" d="M5590.07,-438.589C5607.2,-423.267 5631.3,-396.477 5631.3,-367 5631.3,-367 5631.3,-367 5631.3,-191 5631.3,-107.648 4267.36,-105.612 4022.65,-105.917"/> +<polygon fill="black" stroke="black" points="4022.49,-102.417 4012.49,-105.932 4022.5,-109.417 4022.49,-102.417"/> +<text text-anchor="middle" x="5678.3" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-d][f-0xFF]</text> +</g> +<!-- 75 --> +<g id="node72" class="node"><title>75</title> +<ellipse fill="none" stroke="black" cx="5515.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="5515.3" y="-362.3" font-family="Times,serif" font-size="14.00">75</text> +</g> +<!-- 61->75 --> +<g id="edge100" class="edge"><title>61->75</title> +<path fill="none" stroke="black" d="M5562.66,-436.41C5554.04,-423.788 5541.76,-405.788 5531.86,-391.281"/> +<polygon fill="black" stroke="black" points="5534.59,-389.067 5526.06,-382.779 5528.81,-393.012 5534.59,-389.067"/> +<text text-anchor="middle" x="5555.3" y="-405.8" font-family="Times,serif" font-size="14.00">[e]</text> +</g> +<!-- 62->28 --> +<g id="edge101" class="edge"><title>62->28</title> +<path fill="none" stroke="black" d="M5985.18,-347.669C5988.86,-320.768 5992.81,-267.909 5975.3,-228 5939.27,-145.902 5882.14,-153.058 5793.3,-141 5612.15,-116.414 4264.03,-107.594 4022.34,-106.203"/> +<polygon fill="black" stroke="black" points="4022.32,-102.703 4012.3,-106.146 4022.28,-109.703 4022.32,-102.703"/> +<text text-anchor="middle" x="6027.8" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-c][e-0xFF]</text> +</g> +<!-- 76 --> +<g id="node73" class="node"><title>76</title> +<ellipse fill="none" stroke="black" cx="5834.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="5834.3" y="-275.3" font-family="Times,serif" font-size="14.00">76</text> +</g> +<!-- 62->76 --> +<g id="edge102" class="edge"><title>62->76</title> +<path fill="none" stroke="black" d="M5962.34,-353.537C5936.85,-338.898 5892.55,-313.458 5863.33,-296.674"/> +<polygon fill="black" stroke="black" points="5864.83,-293.499 5854.41,-291.553 5861.34,-299.569 5864.83,-293.499"/> +<text text-anchor="middle" x="5924.3" y="-318.8" font-family="Times,serif" font-size="14.00">[d]</text> +</g> +<!-- 63->27 --> +<g id="edge104" class="edge"><title>63->27</title> +<path fill="none" stroke="black" d="M3422.39,-274.144C3457.18,-268.708 3520.51,-257.779 3573.3,-243 3591.98,-237.769 3595.35,-232.207 3614.3,-228 3649.62,-220.154 3888.74,-202.339 3981.56,-195.625"/> +<polygon fill="black" stroke="black" points="3981.9,-199.11 3991.62,-194.9 3981.4,-192.128 3981.9,-199.11"/> +<text text-anchor="middle" x="3664.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 64 --> +<g id="node74" class="node"><title>64</title> +<ellipse fill="none" stroke="black" cx="3337.3" cy="-192" rx="48.9926" ry="18"/> +<text text-anchor="middle" x="3337.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:81</text> +</g> +<!-- 63->64 --> +<g id="edge103" class="edge"><title>63->64</title> +<path fill="none" stroke="black" d="M3374.33,-268.39C3368.22,-265.854 3361.54,-263.21 3355.3,-261 3328.65,-251.573 3311.22,-265.64 3294.3,-243 3286.87,-233.062 3293.43,-222.577 3303.48,-213.79"/> +<polygon fill="black" stroke="black" points="3305.91,-216.334 3311.66,-207.438 3301.62,-210.804 3305.91,-216.334"/> +<text text-anchor="middle" x="3375.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 65->28 --> +<g id="edge105" class="edge"><title>65->28</title> +<path fill="none" stroke="black" d="M2223.18,-434.895C2222.06,-406.374 2215.75,-348.898 2184.3,-315 2168.51,-297.993 2148.57,-316.025 2135.3,-297 2107.86,-257.697 2166.63,-182.151 2177.3,-174 2240.87,-125.401 2274.7,-149.219 2354.3,-141 2678.11,-107.565 3735.51,-105.955 3947.93,-105.975"/> +<polygon fill="black" stroke="black" points="3948.23,-109.474 3958.24,-105.977 3948.24,-102.474 3948.23,-109.474"/> +<text text-anchor="middle" x="2185.8" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-m][o-0xFF]</text> +</g> +<!-- 78 --> +<g id="node75" class="node"><title>78</title> +<ellipse fill="none" stroke="black" cx="2264.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="2264.3" y="-362.3" font-family="Times,serif" font-size="14.00">78</text> +</g> +<!-- 65->78 --> +<g id="edge106" class="edge"><title>65->78</title> +<path fill="none" stroke="black" d="M2231.2,-435.611C2237.1,-423.382 2245.27,-406.443 2252.02,-392.456"/> +<polygon fill="black" stroke="black" points="2255.22,-393.866 2256.41,-383.339 2248.92,-390.825 2255.22,-393.866"/> +<text text-anchor="middle" x="2254.3" y="-405.8" font-family="Times,serif" font-size="14.00">[n]</text> +</g> +<!-- 66->28 --> +<g id="edge107" class="edge"><title>66->28</title> +<path fill="none" stroke="black" d="M3471.94,-348.264C3462.51,-320.288 3448.61,-263.593 3475.3,-228 3532.84,-151.254 3841.23,-118.189 3948.49,-108.896"/> +<polygon fill="black" stroke="black" points="3948.85,-112.378 3958.52,-108.046 3948.26,-105.403 3948.85,-112.378"/> +<text text-anchor="middle" x="3522.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-g][i-0xFF]</text> +</g> +<!-- 79 --> +<g id="node76" class="node"><title>79</title> +<ellipse fill="none" stroke="black" cx="3718.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="3718.3" y="-275.3" font-family="Times,serif" font-size="14.00">79</text> +</g> +<!-- 66->79 --> +<g id="edge108" class="edge"><title>66->79</title> +<path fill="none" stroke="black" d="M3501.74,-356.695C3544.67,-341.492 3635.98,-309.153 3685.21,-291.719"/> +<polygon fill="black" stroke="black" points="3686.49,-294.976 3694.75,-288.339 3684.16,-288.378 3686.49,-294.976"/> +<text text-anchor="middle" x="3621.3" y="-318.8" font-family="Times,serif" font-size="14.00">[h]</text> +</g> +<!-- 67->28 --> +<g id="edge109" class="edge"><title>67->28</title> +<path fill="none" stroke="black" d="M4386.75,-348.354C4396.22,-321 4410.37,-265.813 4387.3,-228 4348.28,-164.07 4113.15,-124.198 4021.67,-110.927"/> +<polygon fill="black" stroke="black" points="4021.9,-107.423 4011.5,-109.476 4020.91,-114.353 4021.9,-107.423"/> +<text text-anchor="middle" x="4441.8" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-c][e-0xFF]</text> +</g> +<!-- 81 --> +<g id="node77" class="node"><title>81</title> +<ellipse fill="none" stroke="black" cx="4337.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="4337.3" y="-275.3" font-family="Times,serif" font-size="14.00">81</text> +</g> +<!-- 67->81 --> +<g id="edge110" class="edge"><title>67->81</title> +<path fill="none" stroke="black" d="M4372,-348.611C4365.82,-336.382 4357.25,-319.443 4350.17,-305.456"/> +<polygon fill="black" stroke="black" points="4353.2,-303.682 4345.56,-296.339 4346.95,-306.842 4353.2,-303.682"/> +<text text-anchor="middle" x="4370.3" y="-318.8" font-family="Times,serif" font-size="14.00">[d]</text> +</g> +<!-- 68->27 --> +<g id="edge112" class="edge"><title>68->27</title> +<path fill="none" stroke="black" d="M4161.38,-355.987C4137.18,-345.352 4099.52,-325.445 4077.3,-297 4057.39,-271.527 4071.48,-255.377 4054.3,-228 4051.03,-222.798 4046.83,-217.807 4042.47,-213.306"/> +<polygon fill="black" stroke="black" points="4044.74,-210.632 4035.09,-206.243 4039.89,-215.688 4044.74,-210.632"/> +<text text-anchor="middle" x="4127.3" y="-275.3" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 69 --> +<g id="node78" class="node"><title>69</title> +<ellipse fill="none" stroke="black" cx="4239.3" cy="-279" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="4239.3" y="-275.3" font-family="Times,serif" font-size="14.00">lexer.re:172</text> +</g> +<!-- 68->69 --> +<g id="edge111" class="edge"><title>68->69</title> +<path fill="none" stroke="black" d="M4183.01,-347.692C4183.04,-337.519 4184.5,-324.778 4190.3,-315 4193.55,-309.511 4198.04,-304.65 4202.98,-300.43"/> +<polygon fill="black" stroke="black" points="4205.18,-303.159 4211.03,-294.326 4200.94,-297.583 4205.18,-303.159"/> +<text text-anchor="middle" x="4271.3" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 70->28 --> +<g id="edge113" class="edge"><title>70->28</title> +<path fill="none" stroke="black" d="M6409.59,-434.921C6415.47,-388.65 6429.09,-262.068 6407.3,-228 6349.96,-138.387 6289.34,-157.83 6184.3,-141 5962.7,-105.497 4293.38,-105.685 4022.41,-105.952"/> +<polygon fill="black" stroke="black" points="4022.3,-102.452 4012.31,-105.963 4022.31,-109.452 4022.3,-102.452"/> +<text text-anchor="middle" x="6465.8" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-q][s-0xFF]</text> +</g> +<!-- 83 --> +<g id="node79" class="node"><title>83</title> +<ellipse fill="none" stroke="black" cx="6325.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="6325.3" y="-362.3" font-family="Times,serif" font-size="14.00">83</text> +</g> +<!-- 70->83 --> +<g id="edge114" class="edge"><title>70->83</title> +<path fill="none" stroke="black" d="M6393.01,-437.194C6380.2,-423.909 6361.21,-404.228 6346.6,-389.084"/> +<polygon fill="black" stroke="black" points="6348.88,-386.403 6339.41,-381.636 6343.84,-391.263 6348.88,-386.403"/> +<text text-anchor="middle" x="6377.3" y="-405.8" font-family="Times,serif" font-size="14.00">[r]</text> +</g> +<!-- 54->53 --> +<g id="edge90" class="edge"><title>54->53</title> +<path fill="none" stroke="black" d="M1029.8,-557.758C1034.45,-569.741 1040.81,-586.104 1046.12,-599.803"/> +<polygon fill="black" stroke="black" points="1042.89,-601.151 1049.78,-609.207 1049.42,-598.618 1042.89,-601.151"/> +<text text-anchor="middle" x="1083.3" y="-579.8" font-family="Times,serif" font-size="14.00">[0-9][A-F][a-f]</text> +</g> +<!-- 55 --> +<g id="node67" class="node"><title>55</title> +<ellipse fill="none" stroke="black" cx="842.295" cy="-453" rx="48.9926" ry="18"/> +<text text-anchor="middle" x="842.295" y="-449.3" font-family="Times,serif" font-size="14.00">lexer.re:66</text> +</g> +<!-- 54->55 --> +<g id="edge89" class="edge"><title>54->55</title> +<path fill="none" stroke="black" d="M996.381,-537.772C951.073,-535.085 862.61,-526.961 843.295,-504 838.029,-497.74 836.504,-489.315 836.679,-481.167"/> +<polygon fill="black" stroke="black" points="840.166,-481.471 837.657,-471.177 833.2,-480.789 840.166,-481.471"/> +<text text-anchor="middle" x="918.795" y="-492.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][G-`][g-0xFF]</text> +</g> +<!-- 71->27 --> +<g id="edge116" class="edge"><title>71->27</title> +<path fill="none" stroke="black" d="M4722.39,-271.468C4679.17,-260.429 4587.32,-238.284 4508.3,-228 4357.36,-208.358 4317.98,-222.691 4166.3,-210 4128.02,-206.798 4084.36,-201.591 4054.43,-197.782"/> +<polygon fill="black" stroke="black" points="4054.81,-194.303 4044.45,-196.499 4053.92,-201.245 4054.81,-194.303"/> +<text text-anchor="middle" x="4645.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 72 --> +<g id="node80" class="node"><title>72</title> +<ellipse fill="none" stroke="black" cx="4773.3" cy="-192" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="4773.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:165</text> +</g> +<!-- 71->72 --> +<g id="edge115" class="edge"><title>71->72</title> +<path fill="none" stroke="black" d="M4733.99,-262.884C4726.84,-252.839 4720.55,-239.443 4726.3,-228 4728.99,-222.642 4732.93,-217.895 4737.4,-213.763"/> +<polygon fill="black" stroke="black" points="4739.72,-216.39 4745.31,-207.39 4735.33,-210.939 4739.72,-216.39"/> +<text text-anchor="middle" x="4807.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 73->28 --> +<g id="edge117" class="edge"><title>73->28</title> +<path fill="none" stroke="black" d="M1331.5,-522.005C1337.32,-485.725 1345.48,-399.79 1304.3,-348 1289.85,-329.842 1268.57,-349.025 1255.3,-330 1201.71,-253.232 1257.61,-164.27 1348.3,-141 1479.92,-107.223 3635.78,-105.993 3947.78,-105.993"/> +<polygon fill="black" stroke="black" points="3948.09,-109.493 3958.09,-105.993 3948.09,-102.493 3948.09,-109.493"/> +<text text-anchor="middle" x="1305.8" y="-318.8" font-family="Times,serif" font-size="14.00">[0x00-k][m-0xFF]</text> +</g> +<!-- 84 --> +<g id="node81" class="node"><title>84</title> +<ellipse fill="none" stroke="black" cx="1438.3" cy="-453" rx="27" ry="18"/> +<text text-anchor="middle" x="1438.3" y="-449.3" font-family="Times,serif" font-size="14.00">84</text> +</g> +<!-- 73->84 --> +<g id="edge118" class="edge"><title>73->84</title> +<path fill="none" stroke="black" d="M1345.48,-525.719C1363.65,-511.684 1392.47,-489.409 1413.18,-473.407"/> +<polygon fill="black" stroke="black" points="1415.46,-476.072 1421.23,-467.188 1411.18,-470.533 1415.46,-476.072"/> +<text text-anchor="middle" x="1396.8" y="-492.8" font-family="Times,serif" font-size="14.00">[l]</text> +</g> +<!-- 74->28 --> +<g id="edge119" class="edge"><title>74->28</title> +<path fill="none" stroke="black" d="M1149.16,-435.869C1129.61,-402.619 1090.46,-324.271 1112.3,-261 1134.39,-196.957 1145.57,-171.043 1206.3,-141 1270.67,-109.15 3620.63,-106.269 3947.67,-106.022"/> +<polygon fill="black" stroke="black" points="3948.02,-109.522 3958.02,-106.015 3948.02,-102.522 3948.02,-109.522"/> +<text text-anchor="middle" x="1159.3" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-t][v-0xFF]</text> +</g> +<!-- 85 --> +<g id="node82" class="node"><title>85</title> +<ellipse fill="none" stroke="black" cx="1383.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="1383.3" y="-362.3" font-family="Times,serif" font-size="14.00">85</text> +</g> +<!-- 74->85 --> +<g id="edge120" class="edge"><title>74->85</title> +<path fill="none" stroke="black" d="M1182.42,-443.224C1222.52,-428.01 1305.02,-396.704 1350.83,-379.319"/> +<polygon fill="black" stroke="black" points="1352.19,-382.549 1360.29,-375.729 1349.7,-376.004 1352.19,-382.549"/> +<text text-anchor="middle" x="1293.3" y="-405.8" font-family="Times,serif" font-size="14.00">[u]</text> +</g> +<!-- 75->28 --> +<g id="edge121" class="edge"><title>75->28</title> +<path fill="none" stroke="black" d="M5517.81,-347.913C5520.98,-319.419 5522.87,-261.981 5493.3,-228 5400.75,-121.667 5327.88,-160.637 5188.3,-141 4954.99,-108.178 4199.16,-106.023 4022.48,-105.974"/> +<polygon fill="black" stroke="black" points="4022.38,-102.475 4012.38,-105.974 4022.38,-109.475 4022.38,-102.475"/> +<text text-anchor="middle" x="5552.8" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-k][m-0xFF]</text> +</g> +<!-- 86 --> +<g id="node83" class="node"><title>86</title> +<ellipse fill="none" stroke="black" cx="5229.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="5229.3" y="-275.3" font-family="Times,serif" font-size="14.00">86</text> +</g> +<!-- 75->86 --> +<g id="edge122" class="edge"><title>75->86</title> +<path fill="none" stroke="black" d="M5490.91,-357.753C5439.94,-342.604 5322,-307.551 5263.49,-290.162"/> +<polygon fill="black" stroke="black" points="5264.2,-286.723 5253.62,-287.229 5262.21,-293.433 5264.2,-286.723"/> +<text text-anchor="middle" x="5395.8" y="-318.8" font-family="Times,serif" font-size="14.00">[l]</text> +</g> +<!-- 76->27 --> +<g id="edge124" class="edge"><title>76->27</title> +<path fill="none" stroke="black" d="M5808.51,-273.035C5787.32,-269.145 5756.47,-263.919 5729.3,-261 5654.95,-253.013 5464.37,-266.217 5393.3,-243 5381.69,-239.211 5381.97,-231.565 5370.3,-228 5306.32,-208.459 4233.05,-214.322 4166.3,-210 4127.97,-207.519 4084.31,-202.196 4054.4,-198.163"/> +<polygon fill="black" stroke="black" points="4054.81,-194.687 4044.42,-196.797 4053.86,-201.622 4054.81,-194.687"/> +<text text-anchor="middle" x="5443.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 77 --> +<g id="node84" class="node"><title>77</title> +<ellipse fill="none" stroke="black" cx="5860.3" cy="-192" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="5860.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:179</text> +</g> +<!-- 76->77 --> +<g id="edge123" class="edge"><title>76->77</title> +<path fill="none" stroke="black" d="M5820.99,-262.884C5813.84,-252.839 5807.55,-239.443 5813.3,-228 5815.99,-222.642 5819.93,-217.895 5824.4,-213.763"/> +<polygon fill="black" stroke="black" points="5826.72,-216.39 5832.31,-207.39 5822.33,-210.939 5826.72,-216.39"/> +<text text-anchor="middle" x="5894.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 78->28 --> +<g id="edge125" class="edge"><title>78->28</title> +<path fill="none" stroke="black" d="M2265.18,-347.93C2265.39,-325.2 2262.3,-285.069 2240.3,-261 2222.94,-242.018 2200.39,-263.824 2185.3,-243 2163.8,-213.348 2190.86,-193.55 2228.3,-174 2307.2,-132.794 3701.3,-110.22 3948.11,-106.538"/> +<polygon fill="black" stroke="black" points="3948.4,-110.034 3958.34,-106.386 3948.29,-103.035 3948.4,-110.034"/> +<text text-anchor="middle" x="2232.8" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-s][u-0xFF]</text> +</g> +<!-- 88 --> +<g id="node85" class="node"><title>88</title> +<ellipse fill="none" stroke="black" cx="2837.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="2837.3" y="-275.3" font-family="Times,serif" font-size="14.00">88</text> +</g> +<!-- 78->88 --> +<g id="edge126" class="edge"><title>78->88</title> +<path fill="none" stroke="black" d="M2290.4,-361.127C2382.78,-347.423 2694.33,-301.207 2801.07,-285.374"/> +<polygon fill="black" stroke="black" points="2801.65,-288.825 2811.03,-283.896 2800.63,-281.901 2801.65,-288.825"/> +<text text-anchor="middle" x="2591.8" y="-318.8" font-family="Times,serif" font-size="14.00">[t]</text> +</g> +<!-- 79->27 --> +<g id="edge128" class="edge"><title>79->27</title> +<path fill="none" stroke="black" d="M3744.87,-275.316C3777.89,-271.309 3835.47,-262.088 3881.3,-243 3892.56,-238.307 3893.24,-233.175 3904.3,-228 3929.77,-216.07 3960.33,-206.944 3983.39,-201.006"/> +<polygon fill="black" stroke="black" points="3984.24,-204.401 3993.09,-198.58 3982.54,-197.61 3984.24,-204.401"/> +<text text-anchor="middle" x="3954.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 80 --> +<g id="node86" class="node"><title>80</title> +<ellipse fill="none" stroke="black" cx="3718.3" cy="-192" rx="48.9926" ry="18"/> +<text text-anchor="middle" x="3718.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:74</text> +</g> +<!-- 79->80 --> +<g id="edge127" class="edge"><title>79->80</title> +<path fill="none" stroke="black" d="M3718.3,-260.799C3718.3,-249.163 3718.3,-233.548 3718.3,-220.237"/> +<polygon fill="black" stroke="black" points="3721.8,-220.175 3718.3,-210.175 3714.8,-220.175 3721.8,-220.175"/> +<text text-anchor="middle" x="3799.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 81->27 --> +<g id="edge130" class="edge"><title>81->27</title> +<path fill="none" stroke="black" d="M4316.82,-266.852C4311.86,-264.571 4306.49,-262.433 4301.3,-261 4221.66,-239.038 4195.59,-266.178 4116.3,-243 4102.46,-238.955 4070.86,-222.294 4047.26,-209.302"/> +<polygon fill="black" stroke="black" points="4048.79,-206.148 4038.35,-204.361 4045.4,-212.27 4048.79,-206.148"/> +<text text-anchor="middle" x="4166.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 82 --> +<g id="node87" class="node"><title>82</title> +<ellipse fill="none" stroke="black" cx="4224.3" cy="-192" rx="48.9926" ry="18"/> +<text text-anchor="middle" x="4224.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:95</text> +</g> +<!-- 81->82 --> +<g id="edge129" class="edge"><title>81->82</title> +<path fill="none" stroke="black" d="M4316.66,-267.357C4311.71,-265.056 4306.38,-262.782 4301.3,-261 4268.53,-249.526 4247.1,-270.011 4225.3,-243 4220.16,-236.635 4218.67,-228.182 4218.83,-220.041"/> +<polygon fill="black" stroke="black" points="4222.32,-220.362 4219.78,-210.075 4215.35,-219.699 4222.32,-220.362"/> +<text text-anchor="middle" x="4306.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 83->28 --> +<g id="edge131" class="edge"><title>83->28</title> +<path fill="none" stroke="black" d="M6325.79,-347.974C6325.9,-321.03 6323.28,-267.566 6303.3,-228 6262.88,-147.97 6210.15,-152.926 6121.3,-141 5905.68,-112.063 4291.12,-106.768 4022.98,-106.086"/> +<polygon fill="black" stroke="black" points="4022.62,-102.585 4012.61,-106.06 4022.6,-109.585 4022.62,-102.585"/> +<text text-anchor="middle" x="6356.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-d][f-0xFF]</text> +</g> +<!-- 90 --> +<g id="node88" class="node"><title>90</title> +<ellipse fill="none" stroke="black" cx="6246.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="6246.3" y="-275.3" font-family="Times,serif" font-size="14.00">90</text> +</g> +<!-- 83->90 --> +<g id="edge132" class="edge"><title>83->90</title> +<path fill="none" stroke="black" d="M6311.53,-350.194C6299.19,-336.909 6280.9,-317.228 6266.82,-302.084"/> +<polygon fill="black" stroke="black" points="6269.27,-299.578 6259.9,-294.636 6264.14,-304.344 6269.27,-299.578"/> +<text text-anchor="middle" x="6298.3" y="-318.8" font-family="Times,serif" font-size="14.00">[e]</text> +</g> +<!-- 84->28 --> +<g id="edge133" class="edge"><title>84->28</title> +<path fill="none" stroke="black" d="M1440.44,-434.835C1443,-407.701 1444.69,-353.98 1424.3,-315 1418.6,-304.108 1408.43,-308.168 1403.3,-297 1396.61,-282.464 1399.95,-276.646 1403.3,-261 1417.29,-195.546 1430.15,-160.125 1494.3,-141 1616.99,-104.417 3644.46,-105.566 3947.52,-105.944"/> +<polygon fill="black" stroke="black" points="3947.96,-109.444 3957.96,-105.957 3947.96,-102.444 3947.96,-109.444"/> +<text text-anchor="middle" x="1448.8" y="-275.3" font-family="Times,serif" font-size="14.00">[0x00-r][t-0xFF]</text> +</g> +<!-- 92 --> +<g id="node89" class="node"><title>92</title> +<ellipse fill="none" stroke="black" cx="1512.3" cy="-366" rx="27" ry="18"/> +<text text-anchor="middle" x="1512.3" y="-362.3" font-family="Times,serif" font-size="14.00">92</text> +</g> +<!-- 84->92 --> +<g id="edge134" class="edge"><title>84->92</title> +<path fill="none" stroke="black" d="M1451.52,-436.804C1462.89,-423.75 1479.44,-404.735 1492.4,-389.847"/> +<polygon fill="black" stroke="black" points="1495.25,-391.905 1499.18,-382.065 1489.97,-387.309 1495.25,-391.905"/> +<text text-anchor="middle" x="1487.8" y="-405.8" font-family="Times,serif" font-size="14.00">[s]</text> +</g> +<!-- 85->28 --> +<g id="edge135" class="edge"><title>85->28</title> +<path fill="none" stroke="black" d="M1377.03,-348.123C1372.96,-338.103 1367.13,-325.371 1360.3,-315 1336.57,-279.004 1310.77,-283.238 1295.3,-243 1272.32,-183.275 1323.37,-167.338 1389.3,-141 1451.44,-116.17 3633.7,-107.284 3947.79,-106.132"/> +<polygon fill="black" stroke="black" points="3948.18,-109.631 3958.17,-106.094 3948.15,-102.631 3948.18,-109.631"/> +<text text-anchor="middle" x="1342.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-d][f-0xFF]</text> +</g> +<!-- 93 --> +<g id="node90" class="node"><title>93</title> +<ellipse fill="none" stroke="black" cx="1615.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="1615.3" y="-275.3" font-family="Times,serif" font-size="14.00">93</text> +</g> +<!-- 85->93 --> +<g id="edge136" class="edge"><title>85->93</title> +<path fill="none" stroke="black" d="M1406.39,-356.539C1447.8,-341.367 1534.79,-309.494 1582.42,-292.046"/> +<polygon fill="black" stroke="black" points="1583.77,-295.279 1591.95,-288.553 1581.36,-288.707 1583.77,-295.279"/> +<text text-anchor="middle" x="1521.3" y="-318.8" font-family="Times,serif" font-size="14.00">[e]</text> +</g> +<!-- 86->27 --> +<g id="edge138" class="edge"><title>86->27</title> +<path fill="none" stroke="black" d="M5205.18,-270.729C5165.43,-259.133 5083.46,-236.861 5012.3,-228 4825.69,-204.767 4353.91,-222.743 4166.3,-210 4127.98,-207.397 4084.32,-202.094 4054.4,-198.099"/> +<polygon fill="black" stroke="black" points="4054.81,-194.622 4044.43,-196.747 4053.87,-201.559 4054.81,-194.622"/> +<text text-anchor="middle" x="5146.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 87 --> +<g id="node91" class="node"><title>87</title> +<ellipse fill="none" stroke="black" cx="5255.3" cy="-192" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="5255.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:205</text> +</g> +<!-- 86->87 --> +<g id="edge137" class="edge"><title>86->87</title> +<path fill="none" stroke="black" d="M5215.99,-262.884C5208.84,-252.839 5202.55,-239.443 5208.3,-228 5210.99,-222.642 5214.93,-217.895 5219.4,-213.763"/> +<polygon fill="black" stroke="black" points="5221.72,-216.39 5227.31,-207.39 5217.33,-210.939 5221.72,-216.39"/> +<text text-anchor="middle" x="5289.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 88->27 --> +<g id="edge140" class="edge"><title>88->27</title> +<path fill="none" stroke="black" d="M2863.86,-275.72C2914.55,-271.154 3028.49,-259.86 3123.3,-243 3152.06,-237.885 3158.33,-231.798 3187.3,-228 3446.97,-193.949 3514.73,-223.179 3776.3,-210 3849.03,-206.335 3933.92,-199.865 3981.36,-196.051"/> +<polygon fill="black" stroke="black" points="3981.77,-199.529 3991.46,-195.234 3981.21,-192.552 3981.77,-199.529"/> +<text text-anchor="middle" x="3237.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 89 --> +<g id="node92" class="node"><title>89</title> +<ellipse fill="none" stroke="black" cx="2837.3" cy="-192" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="2837.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:102</text> +</g> +<!-- 88->89 --> +<g id="edge139" class="edge"><title>88->89</title> +<path fill="none" stroke="black" d="M2837.3,-260.799C2837.3,-249.163 2837.3,-233.548 2837.3,-220.237"/> +<polygon fill="black" stroke="black" points="2840.8,-220.175 2837.3,-210.175 2833.8,-220.175 2840.8,-220.175"/> +<text text-anchor="middle" x="2918.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 90->27 --> +<g id="edge142" class="edge"><title>90->27</title> +<path fill="none" stroke="black" d="M6225.06,-267.511C6218.84,-264.904 6211.92,-262.444 6205.3,-261 6096.88,-237.375 5816.65,-254.56 5706.3,-243 5667.71,-238.958 5658.93,-231.585 5620.3,-228 5298.54,-198.143 4488.78,-230.464 4166.3,-210 4127.97,-207.568 4084.31,-202.237 4054.4,-198.189"/> +<polygon fill="black" stroke="black" points="4054.81,-194.713 4044.42,-196.818 4053.85,-201.648 4054.81,-194.713"/> +<text text-anchor="middle" x="5756.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 91 --> +<g id="node93" class="node"><title>91</title> +<ellipse fill="none" stroke="black" cx="6188.3" cy="-192" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="6188.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:186</text> +</g> +<!-- 90->91 --> +<g id="edge141" class="edge"><title>90->91</title> +<path fill="none" stroke="black" d="M6224.35,-268.337C6218.24,-265.801 6211.56,-263.17 6205.3,-261 6177.38,-251.324 6159.14,-266.553 6141.3,-243 6133.48,-232.684 6140.76,-222.119 6151.73,-213.375"/> +<polygon fill="black" stroke="black" points="6154.08,-216 6160.21,-207.359 6150.03,-210.291 6154.08,-216"/> +<text text-anchor="middle" x="6222.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 92->28 --> +<g id="edge143" class="edge"><title>92->28</title> +<path fill="none" stroke="black" d="M1515.16,-348.01C1517.96,-325.369 1519.17,-285.341 1498.3,-261 1479.9,-239.542 1454.22,-265.64 1437.3,-243 1433.3,-237.66 1434.63,-234.109 1437.3,-228 1460.09,-175.839 1478.44,-162.141 1531.3,-141 1589.91,-117.554 3644.35,-107.518 3947.96,-106.161"/> +<polygon fill="black" stroke="black" points="3948.03,-109.661 3958.02,-106.117 3948,-102.661 3948.03,-109.661"/> +<text text-anchor="middle" x="1484.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-d][f-0xFF]</text> +</g> +<!-- 95 --> +<g id="node94" class="node"><title>95</title> +<ellipse fill="none" stroke="black" cx="1955.3" cy="-279" rx="27" ry="18"/> +<text text-anchor="middle" x="1955.3" y="-275.3" font-family="Times,serif" font-size="14.00">95</text> +</g> +<!-- 92->95 --> +<g id="edge144" class="edge"><title>92->95</title> +<path fill="none" stroke="black" d="M1538.03,-360.063C1613.35,-345.609 1833.52,-303.366 1919.91,-286.789"/> +<polygon fill="black" stroke="black" points="1920.61,-290.22 1929.77,-284.898 1919.29,-283.345 1920.61,-290.22"/> +<text text-anchor="middle" x="1769.3" y="-318.8" font-family="Times,serif" font-size="14.00">[e]</text> +</g> +<!-- 93->27 --> +<g id="edge146" class="edge"><title>93->27</title> +<path fill="none" stroke="black" d="M1639.73,-270.965C1653.8,-267.254 1671.9,-263.054 1688.3,-261 1785.45,-248.831 2477.13,-276.054 2569.3,-243 2579.42,-239.368 2578.16,-231.605 2588.3,-228 2650.49,-205.88 3710.35,-212.814 3776.3,-210 3849.06,-206.895 3933.94,-200.228 3981.37,-196.228"/> +<polygon fill="black" stroke="black" points="3981.8,-199.704 3991.46,-195.369 3981.2,-192.73 3981.8,-199.704"/> +<text text-anchor="middle" x="2638.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 94 --> +<g id="node95" class="node"><title>94</title> +<ellipse fill="none" stroke="black" cx="1626.3" cy="-192" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="1626.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:144</text> +</g> +<!-- 93->94 --> +<g id="edge145" class="edge"><title>93->94</title> +<path fill="none" stroke="black" d="M1596.93,-265.769C1584.81,-256.061 1572.34,-241.861 1579.3,-228 1581.99,-222.642 1585.93,-217.895 1590.4,-213.763"/> +<polygon fill="black" stroke="black" points="1592.72,-216.39 1598.31,-207.39 1588.33,-210.939 1592.72,-216.39"/> +<text text-anchor="middle" x="1660.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +<!-- 95->27 --> +<g id="edge148" class="edge"><title>95->27</title> +<path fill="none" stroke="black" d="M1981.52,-274.56C2012.82,-270.598 2066.78,-264.221 2113.3,-261 2241.72,-252.108 2565.91,-267.426 2692.3,-243 2711.35,-239.318 2714.22,-231.55 2733.3,-228 2847.25,-206.794 3660.5,-215.063 3776.3,-210 3849.06,-206.819 3933.94,-200.179 3981.37,-196.204"/> +<polygon fill="black" stroke="black" points="3981.79,-199.68 3991.46,-195.351 3981.2,-192.705 3981.79,-199.68"/> +<text text-anchor="middle" x="2783.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0-9][A-Z][_][a-z]</text> +</g> +<!-- 96 --> +<g id="node96" class="node"><title>96</title> +<ellipse fill="none" stroke="black" cx="1981.3" cy="-192" rx="53.0913" ry="18"/> +<text text-anchor="middle" x="1981.3" y="-188.3" font-family="Times,serif" font-size="14.00">lexer.re:151</text> +</g> +<!-- 95->96 --> +<g id="edge147" class="edge"><title>95->96</title> +<path fill="none" stroke="black" d="M1941.99,-262.884C1934.84,-252.839 1928.55,-239.443 1934.3,-228 1936.99,-222.642 1940.93,-217.895 1945.4,-213.763"/> +<polygon fill="black" stroke="black" points="1947.72,-216.39 1953.31,-207.39 1943.33,-210.939 1947.72,-216.39"/> +<text text-anchor="middle" x="2015.3" y="-231.8" font-family="Times,serif" font-size="14.00">[0x00-/][:-@][[-^][`][{-0xFF]</text> +</g> +</g> +</svg> diff --git a/spasm/src/asm/lexdump.cpp b/spasm/src/asm/lexdump.cpp new file mode 100644 index 0000000..440ff1e --- /dev/null +++ b/spasm/src/asm/lexdump.cpp @@ -0,0 +1,83 @@ +#include <iomanip> +#include <iostream> + +#include <cassert> + +#include "lexer.hpp" +#include "token.hpp" + +using namespace SpasmImpl::ASM::Lexer; + +#define TOKENS \ + TOK(push) \ + TOK(pop) \ + TOK(dup) \ + TOK(print) \ + TOK(read) \ + TOK(plus) \ + TOK(minus) \ + TOK(multiply) \ + TOK(divide) \ + TOK(modulus) \ + TOK(gotrue) \ + TOK(gofalse) \ + TOK(go) \ + TOK(call) \ + TOK(ret) \ + TOK(load) \ + TOK(store) \ + TOK(label) \ + TOK(ident) \ + TOK(integer) \ + TOK(xinteger) \ + TOK(endinput) + +class TokenDumper : public TokenStream +{ + public: + TokenDumper() : end_reached(false) {} + void push_token(const Token& token) + { + Token::Token_type ttype = token.type(); + std::cout.width(8); + std::cout << token.lineno(); + std::cout << ": " << token_name[ttype]; + if (ttype == Token::integer || ttype == Token::xinteger) + std::cout << '|' << token.value_int() << '|'; + else if (ttype == Token::ident) + std::cout << '|' << token.value_str() << '|'; + std::cout << std::endl; + if (token.type() == Token::endinput) + end_reached = true; + } + + bool input_end() const { return end_reached; } + + private: + bool end_reached; + + static const char* token_name[24]; +}; + +const char* TokenDumper::token_name[24] = {"halt", +#define TOK(x) #x, + TOKENS +#undef TOK + "notused!!!"}; + +int main() +{ + Lexer lex(std::cin); + TokenDumper td; + Token token; + + lex.buffer_init(); + + while (!td.input_end()) + { + lex.read(1); + lex.tokenize(td); + } + + return 0; +} diff --git a/spasm/src/asm/lexdump3.cpp b/spasm/src/asm/lexdump3.cpp new file mode 100644 index 0000000..4e4ce9e --- /dev/null +++ b/spasm/src/asm/lexdump3.cpp @@ -0,0 +1,62 @@ +#include <iomanip> +#include <iostream> + +#include <cassert> + +#include "token.hpp" +#include "tokenizer.hpp" + +using namespace SpasmImpl::ASM::Lexer; + +#define TOKENS \ + TOK(push) \ + TOK(pop) \ + TOK(dup) \ + TOK(print) \ + TOK(read) \ + TOK(plus) \ + TOK(minus) \ + TOK(multiply) \ + TOK(divide) \ + TOK(modulus) \ + TOK(gotrue) \ + TOK(gofalse) \ + TOK(go) \ + TOK(call) \ + TOK(ret) \ + TOK(load) \ + TOK(store) \ + TOK(label) \ + TOK(ident) \ + TOK(integer) \ + TOK(xinteger) \ + TOK(endinput) + +const char* token_name[24] = {"halt", +#define TOK(x) #x, + TOKENS +#undef TOK + "notused!!!"}; + +int main() +{ + Tokenizer td(std::cin); + Token token; + + token = td.next_token(); + while (token.type() != Token::endinput) + { + token = td.next_token(); + Token::Token_type ttype = token.type(); + std::cout.width(8); + std::cout << token.lineno(); + std::cout << ": " << token_name[ttype]; + if (ttype == Token::integer || ttype == Token::xinteger) + std::cout << '|' << token.value_int() << '|'; + else if (ttype == Token::ident) + std::cout << '|' << token.value_str() << '|'; + std::cout << std::endl; + } + + return 0; +} diff --git a/spasm/src/asm/lexer.cpp b/spasm/src/asm/lexer.cpp new file mode 100644 index 0000000..fd522ee --- /dev/null +++ b/spasm/src/asm/lexer.cpp @@ -0,0 +1,3106 @@ +/* Generated by re2c 1.1.1 on Wed Nov 28 21:13:09 2018 */ +#line 1 "lexer.re" +#include <iostream> + +#include "lexer.hpp" + +#include "token.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +//! Namespace for all lexical analisys classes +namespace Lexer +{ +Lexer::Lexer(std::istream& _file, size_t _buffer_size) + : file(&_file), buffer_size(_buffer_size), state(unsigned(-1)), lineno(0) +{ + buffer = new char[buffer_size]; + cursor = limit = marker = token_start = NULL; +} + +Lexer::~Lexer() +{ + delete[] buffer; +} + +bool Lexer::tokenize(TokenStream& ts) +{ +#line 43 "lexer.re" + + while (1) + { +#line 41 "lexer.cpp" + { + char yych; + if ((limit - cursor) < 7) + return true; + yych = *cursor; + switch (yych) + { + case 0x00: + goto yy2; + case '\n': + goto yy6; + case ' ': + goto yy8; + case '"': + goto yy11; + case '#': + goto yy13; + case '\'': + goto yy15; + case '-': + goto yy17; + case '0': + goto yy18; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy20; + case ':': + goto yy22; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'b': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'k': + case 'n': + case 'o': + case 'q': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + case 'a': + goto yy27; + case 'c': + goto yy28; + case 'd': + goto yy29; + case 'j': + goto yy30; + case 'l': + goto yy31; + case 'm': + goto yy32; + case 'p': + goto yy33; + case 'r': + goto yy34; + case 's': + goto yy35; + default: + goto yy4; + } + yy2: + ++cursor; +#line 290 "lexer.re" + { + ts.push_token(Token(Token::EndInput, lineno)); + + break; + } +#line 128 "lexer.cpp" + yy4: + ++cursor; + yy5: +#line 296 "lexer.re" + { + return false; + } +#line 136 "lexer.cpp" + yy6: + ++cursor; +#line 283 "lexer.re" + { + ++lineno; + token_start = cursor; + + continue; + } +#line 146 "lexer.cpp" + yy8: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case ' ': + goto yy8; + default: + goto yy10; + } + yy10: +#line 267 "lexer.re" + { + token_start = cursor; + + continue; + } +#line 162 "lexer.cpp" + yy11: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '"': + goto yy36; + case '\\': + goto yy38; + default: + goto yy11; + } + yy13: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '\n': + goto yy40; + default: + goto yy13; + } + yy15: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '\'': + goto yy36; + case '\\': + goto yy42; + default: + goto yy15; + } + yy17: + yych = *++cursor; + switch (yych) + { + case '0': + goto yy44; + default: + goto yy5; + } + yy18: + yych = *(marker = ++cursor); + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case ':': + goto yy46; + case 'X': + case 'x': + goto yy48; + default: + goto yy19; + } + yy19: +#line 62 "lexer.re" + { + ts.push_token(Token(Token::Integer, lineno, token_start, cursor)); + token_start = cursor; + + continue; + } +#line 222 "lexer.cpp" + yy20: + marker = ++cursor; + if ((limit - cursor) < 2) + return true; + yych = *cursor; + switch (yych) + { + case '.': + goto yy49; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy20; + case ':': + goto yy22; + default: + goto yy19; + } + yy22: + ++cursor; +#line 272 "lexer.re" + { + token_start = cursor; + + continue; + } +#line 250 "lexer.cpp" + yy24: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + yy25: + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy26; + } + yy26: +#line 252 "lexer.re" + { + ts.push_token(Token(Token::Ident, lineno, token_start, cursor)); + token_start = cursor; + + continue; + } +#line 331 "lexer.cpp" + yy27: + yych = *++cursor; + switch (yych) + { + case '0': + goto yy50; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy52; + case 'd': + goto yy54; + default: + goto yy25; + } + yy28: + yych = *++cursor; + switch (yych) + { + case 'a': + goto yy55; + case 'o': + goto yy56; + default: + goto yy25; + } + yy29: + yych = *++cursor; + switch (yych) + { + case 'i': + goto yy57; + case 'u': + goto yy58; + default: + goto yy25; + } + yy30: + yych = *++cursor; + switch (yych) + { + case 'm': + goto yy59; + default: + goto yy25; + } + yy31: + yych = *++cursor; + switch (yych) + { + case 'a': + goto yy60; + case 'e': + goto yy61; + default: + goto yy25; + } + yy32: + yych = *++cursor; + switch (yych) + { + case 'o': + goto yy62; + case 'u': + goto yy63; + default: + goto yy25; + } + yy33: + yych = *++cursor; + switch (yych) + { + case 'o': + goto yy64; + case 'r': + goto yy65; + case 'u': + goto yy66; + default: + goto yy25; + } + yy34: + yych = *++cursor; + switch (yych) + { + case '0': + goto yy67; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy69; + case 'e': + goto yy71; + default: + goto yy25; + } + yy35: + yych = *++cursor; + switch (yych) + { + case 't': + goto yy72; + case 'u': + goto yy73; + default: + goto yy25; + } + yy36: + ++cursor; +#line 259 "lexer.re" + { + ts.push_token(Token(Token::StringValue, lineno, token_start + 1, + cursor - 1)); + token_start = cursor; + + continue; + } +#line 423 "lexer.cpp" + yy38: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '\\': + goto yy38; + default: + goto yy11; + } + yy40: + ++cursor; +#line 277 "lexer.re" + { + ++lineno; + token_start = cursor; + + continue; + } +#line 441 "lexer.cpp" + yy42: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '\\': + goto yy42; + default: + goto yy15; + } + yy44: + ++cursor; + goto yy19; + yy45: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + yy46: + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy45; + case ':': + goto yy22; + default: + goto yy47; + } + yy47: + cursor = marker; + goto yy19; + yy48: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + goto yy74; + default: + goto yy47; + } + yy49: + yych = *++cursor; + switch (yych) + { + case '0': + goto yy77; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy79; + default: + goto yy47; + } + yy50: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy51; + } + yy51: +#line 86 "lexer.re" + { + Token t(Token::Integer, lineno, token_start + 1, cursor); + t.set_int(-t.value_int()); + ts.push_token(t); + token_start = cursor; + continue; + } +#line 595 "lexer.cpp" + yy52: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy52; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy51; + } + yy54: + yych = *++cursor; + switch (yych) + { + case 'd': + goto yy81; + default: + goto yy25; + } + yy55: + yych = *++cursor; + switch (yych) + { + case 'l': + goto yy83; + default: + goto yy25; + } + yy56: + yych = *++cursor; + switch (yych) + { + case 'n': + goto yy84; + default: + goto yy25; + } + yy57: + yych = *++cursor; + switch (yych) + { + case 'v': + goto yy85; + default: + goto yy25; + } + yy58: + yych = *++cursor; + switch (yych) + { + case 'p': + goto yy87; + default: + goto yy25; + } + yy59: + yych = *++cursor; + switch (yych) + { + case 'p': + goto yy89; + default: + goto yy25; + } + yy60: + yych = *++cursor; + switch (yych) + { + case 'b': + goto yy91; + default: + goto yy25; + } + yy61: + yych = *++cursor; + switch (yych) + { + case 'q': + goto yy92; + case 's': + goto yy94; + default: + goto yy25; + } + yy62: + yych = *++cursor; + switch (yych) + { + case 'd': + goto yy95; + default: + goto yy25; + } + yy63: + yych = *++cursor; + switch (yych) + { + case 'l': + goto yy97; + default: + goto yy25; + } + yy64: + yych = *++cursor; + switch (yych) + { + case 'p': + goto yy99; + default: + goto yy25; + } + yy65: + yych = *++cursor; + switch (yych) + { + case 'i': + goto yy101; + default: + goto yy25; + } + yy66: + yych = *++cursor; + switch (yych) + { + case 's': + goto yy102; + default: + goto yy25; + } + yy67: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy68; + } + yy68: +#line 79 "lexer.re" + { + ts.push_token( + Token(Token::Integer, lineno, token_start + 1, cursor)); + token_start = cursor; + + continue; + } +#line 822 "lexer.cpp" + yy69: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy69; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy68; + } + yy71: + yych = *++cursor; + switch (yych) + { + case 'a': + goto yy103; + case 't': + goto yy104; + default: + goto yy25; + } + yy72: + yych = *++cursor; + switch (yych) + { + case 'r': + goto yy106; + default: + goto yy25; + } + yy73: + yych = *++cursor; + switch (yych) + { + case 'b': + goto yy107; + default: + goto yy25; + } + yy74: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + goto yy74; + default: + goto yy76; + } + yy76: +#line 95 "lexer.re" + { + ts.push_token(Token(Token::XInteger, lineno, token_start, cursor)); + token_start = cursor; + + continue; + } +#line 950 "lexer.cpp" + yy77: + ++cursor; + yy78: +#line 70 "lexer.re" + { + ts.push_token( + Token(Token::FloatingPoint, lineno, token_start, cursor)); + token_start = cursor; + + continue; + } +#line 963 "lexer.cpp" + yy79: + ++cursor; + if (limit <= cursor) + return true; + yych = *cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + goto yy79; + default: + goto yy78; + } + yy81: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy82; + } + yy82: +#line 149 "lexer.re" + { + ts.push_token(Token(Token::Add, lineno)); + token_start = cursor; + + continue; + } +#line 1057 "lexer.cpp" + yy83: + yych = *++cursor; + switch (yych) + { + case 'l': + goto yy109; + default: + goto yy25; + } + yy84: + yych = *++cursor; + switch (yych) + { + case 's': + goto yy111; + default: + goto yy25; + } + yy85: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy86; + } + yy86: +#line 170 "lexer.re" + { + ts.push_token(Token(Token::Div, lineno)); + token_start = cursor; + + continue; + } +#line 1146 "lexer.cpp" + yy87: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy88; + } + yy88: +#line 128 "lexer.re" + { + ts.push_token(Token(Token::Dup, lineno)); + token_start = cursor; + + continue; + } +#line 1223 "lexer.cpp" + yy89: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + case 'f': + goto yy112; + case 't': + goto yy114; + default: + goto yy90; + } + yy90: +#line 198 "lexer.re" + { + ts.push_token(Token(Token::Jump, lineno)); + token_start = cursor; + + continue; + } +#line 1300 "lexer.cpp" + yy91: + yych = *++cursor; + switch (yych) + { + case 'e': + goto yy116; + default: + goto yy25; + } + yy92: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy93; + } + yy93: +#line 232 "lexer.re" + { + ts.push_token(Token(Token::LessEq, lineno)); + token_start = cursor; + + continue; + } +#line 1383 "lexer.cpp" + yy94: + yych = *++cursor; + switch (yych) + { + case 's': + goto yy117; + default: + goto yy25; + } + yy95: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy96; + } + yy96: +#line 177 "lexer.re" + { + ts.push_token(Token(Token::Mod, lineno)); + token_start = cursor; + + continue; + } +#line 1466 "lexer.cpp" + yy97: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy98; + } + yy98: +#line 163 "lexer.re" + { + ts.push_token(Token(Token::Mul, lineno)); + token_start = cursor; + + continue; + } +#line 1543 "lexer.cpp" + yy99: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + case 'r': + goto yy119; + default: + goto yy100; + } + yy100: +#line 115 "lexer.re" + { + ts.push_token(Token(Token::Pop, lineno)); + token_start = cursor; + + continue; + } +#line 1620 "lexer.cpp" + yy101: + yych = *++cursor; + switch (yych) + { + case 'n': + goto yy121; + default: + goto yy25; + } + yy102: + yych = *++cursor; + switch (yych) + { + case 'h': + goto yy122; + default: + goto yy25; + } + yy103: + yych = *++cursor; + switch (yych) + { + case 'd': + goto yy124; + default: + goto yy25; + } + yy104: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy105; + } + yy105: +#line 225 "lexer.re" + { + ts.push_token(Token(Token::Ret, lineno)); + token_start = cursor; + + continue; + } +#line 1715 "lexer.cpp" + yy106: + yych = *++cursor; + switch (yych) + { + case 'i': + goto yy126; + default: + goto yy25; + } + yy107: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy108; + } + yy108: +#line 156 "lexer.re" + { + ts.push_token(Token(Token::Sub, lineno)); + token_start = cursor; + + continue; + } +#line 1798 "lexer.cpp" + yy109: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy110; + } + yy110: +#line 218 "lexer.re" + { + ts.push_token(Token(Token::Call, lineno)); + token_start = cursor; + + continue; + } +#line 1875 "lexer.cpp" + yy111: + yych = *++cursor; + switch (yych) + { + case 't': + goto yy127; + default: + goto yy25; + } + yy112: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy113; + } + yy113: +#line 191 "lexer.re" + { + ts.push_token(Token(Token::JumpF, lineno)); + token_start = cursor; + + continue; + } +#line 1958 "lexer.cpp" + yy114: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy115; + } + yy115: +#line 184 "lexer.re" + { + ts.push_token(Token(Token::JumpT, lineno)); + token_start = cursor; + + continue; + } +#line 2035 "lexer.cpp" + yy116: + yych = *++cursor; + switch (yych) + { + case 'l': + goto yy129; + default: + goto yy25; + } + yy117: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy118; + } + yy118: +#line 238 "lexer.re" + { + ts.push_token(Token(Token::Less, lineno)); + token_start = cursor; + + continue; + } +#line 2118 "lexer.cpp" + yy119: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy120; + } + yy120: +#line 121 "lexer.re" + { + ts.push_token(Token(Token::PopTo, lineno)); + token_start = cursor; + + continue; + } +#line 2195 "lexer.cpp" + yy121: + yych = *++cursor; + switch (yych) + { + case 't': + goto yy131; + default: + goto yy25; + } + yy122: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + case 'r': + goto yy133; + default: + goto yy123; + } + yy123: +#line 109 "lexer.re" + { + ts.push_token(Token(Token::Push, lineno)); + token_start = cursor; + + continue; + } +#line 2278 "lexer.cpp" + yy124: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy125; + } + yy125: +#line 135 "lexer.re" + { + ts.push_token(Token(Token::Read, lineno)); + token_start = cursor; + + continue; + } +#line 2355 "lexer.cpp" + yy126: + yych = *++cursor; + switch (yych) + { + case 'n': + goto yy135; + default: + goto yy25; + } + yy127: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy128; + } + yy128: +#line 204 "lexer.re" + { + ts.push_token(Token(Token::Const, lineno)); + token_start = cursor; + + continue; + } +#line 2438 "lexer.cpp" + yy129: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy130; + } + yy130: +#line 245 "lexer.re" + { + ts.push_token(Token(Token::Label, lineno)); + token_start = cursor; + + continue; + } +#line 2515 "lexer.cpp" + yy131: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy132; + } + yy132: +#line 142 "lexer.re" + { + ts.push_token(Token(Token::Print, lineno)); + token_start = cursor; + + continue; + } +#line 2592 "lexer.cpp" + yy133: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy134; + } + yy134: +#line 103 "lexer.re" + { + ts.push_token(Token(Token::PushFrom, lineno)); + token_start = cursor; + + continue; + } +#line 2669 "lexer.cpp" + yy135: + yych = *++cursor; + switch (yych) + { + case 'g': + goto yy136; + default: + goto yy25; + } + yy136: + yych = *++cursor; + switch (yych) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + goto yy24; + default: + goto yy137; + } + yy137: +#line 211 "lexer.re" + { + ts.push_token(Token(Token::String, lineno)); + token_start = cursor; + + continue; + } +#line 2752 "lexer.cpp" + } +#line 300 "lexer.re" + } + return true; +} + +/*! +** Fills up the buffer when neccessary. +** Note the buffer is always filled to the maximum, not just the +** number of bytes neccessary for the lexer to continue. +** +** \param nbytes - the number of bytes +*/ + +void Lexer::buffer_grow(size_t new_size) +{ + char* new_buffer = new char[new_size]; + + std::copy(buffer, limit, new_buffer); + + token_start = new_buffer + (token_start - buffer); + cursor = new_buffer + (cursor - buffer); + limit = new_buffer + new_size; + + buffer_size = new_size; + + delete[] buffer; + buffer = new_buffer; +} + +void Lexer::read(size_t nbytes) +{ + if (token_start + nbytes > limit) + { // we need larger buffer + buffer_grow(token_start - buffer + nbytes); + } + + std::copy(token_start, limit, buffer); + cursor -= token_start - buffer; + char* old_limit = limit - (token_start - buffer); + token_start = buffer; + + file->read(old_limit, limit - old_limit); + if (file->eof()) + { + auto bytes = file->gcount(); + std::fill(old_limit + bytes, limit, '\0'); + } +} + +void Lexer::buffer_init() +{ + file->read(buffer, buffer_size); + if (file->eof()) + { + auto bytes = file->gcount(); + std::fill(buffer + bytes, buffer + buffer_size, '\0'); + } + + cursor = marker = token_start = buffer; + limit = buffer + buffer_size; +} + +} // namespace Lexer + +} // namespace ASM +} // namespace SpasmImpl diff --git a/spasm/src/asm/lexer.hpp b/spasm/src/asm/lexer.hpp new file mode 100644 index 0000000..e321ba3 --- /dev/null +++ b/spasm/src/asm/lexer.hpp @@ -0,0 +1,67 @@ +#ifndef LEXER_HPP +#define LEXER_HPP + +#include <iostream> + +#include "token.hpp" + +namespace SpasmImpl +{ +// ! Namespace for all classes and functions dealing with assembler +namespace ASM +{ +//! Namespace for all lexical analisys classes +namespace Lexer +{ +/*! +** Class for lexers for the assembler-like language for spasm +*/ +class Lexer +{ + public: + Lexer(std::istream&, size_t = 4096); + ~Lexer(); + bool tokenize(TokenStream&); + + //! fills the buffer called when the lexer needs more data + void read(size_t = 1); + void buffer_init(); + + private: + Lexer(const Lexer&); + Lexer& operator=(const Lexer&); + + void buffer_grow(size_t); + + //! input stream for the lexer + std::istream* file; + + //! buffer for the lexer + char* buffer; + + //! size of the buffer + size_t buffer_size; + + //! cursor for re2c generated lexer + char* cursor; + + //! limit for re2c generated lexer + char* limit; + + //! marker for re2c generated lexer + char* marker; + + //! pointer to the start of the just recognized token + char* token_start; + + //! saves the state of the lexer + unsigned int state; + + //! number of current line + size_t lineno; +}; +} // namespace Lexer +} // namespace ASM +} // namespace SpasmImpl + +#endif diff --git a/spasm/src/asm/lexer.re b/spasm/src/asm/lexer.re new file mode 100644 index 0000000..7de620d --- /dev/null +++ b/spasm/src/asm/lexer.re @@ -0,0 +1,364 @@ +#include <iostream> + +#include "lexer.hpp" + +#include "token.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +//! Namespace for all lexical analisys classes +namespace Lexer +{ + +Lexer::Lexer (std::istream & _file, size_t _buffer_size) + : file (&_file), buffer_size (_buffer_size), state (unsigned(-1)), + lineno (0) +{ + buffer = new char[buffer_size]; + cursor = limit = marker = token_start = NULL; +} + +Lexer::~Lexer () +{ + delete [] buffer; +} + +bool Lexer::tokenize (TokenStream &ts) +{ +/*!re2c +re2c:indent:top = 1; + +re2c:define:YYFILL="return true;"; +re2c:define:YYFILL:naked=1; +re2c:define:YYCTYPE="char"; +re2c:define:YYCURSOR=cursor; +re2c:define:YYLIMIT=limit; +re2c:define:YYMARKER=marker; +re2c:define:YYGETSTATE=state; +re2c:define:YYGETSTATE:naked=1; +re2c:define:YYSETSTATE="state = "; +re2c:define:YYSETSTATE:naked=1; +*/ + +/*!getstate:re2c */ + + while (1) { + +/*!re2c + +DIGIT = [0-9] ; +XDIGIT = [0-9a-fA-F] ; + +INTEGER = "-"? "0" | ([1-9] DIGIT*) ; +NONNEGATIVE = "0" | ([1-9] DIGIT*) ; +XINTEGER = "0" [xX] XDIGIT+ ; +FLOATING = "-"? "0" | ([1-9] DIGIT*) "." NONNEGATIVE ; +IDENTIFIER = [a-zA-Z_] [0-9a-zA-Z_]* ; +SSTRING = "'" ([^']|"\\'")* "'" ; +DSTRING = "\"" ([^"]|"\\\"")* "\"" ; + +INTEGER { + ts.push_token (Token (Token::Integer, lineno, + token_start, cursor)); + token_start = cursor; + + continue; + } + +FLOATING { + ts.push_token (Token (Token::FloatingPoint, + lineno, token_start, + cursor)); + token_start = cursor; + + continue; + } + +"r" NONNEGATIVE { + ts.push_token (Token (Token::Integer, lineno, + token_start + 1, cursor)); + token_start = cursor; + + continue; + } +"a" NONNEGATIVE { + Token t(Token::Integer, lineno, + token_start + 1, cursor); + t.set_int(-t.value_int()); + ts.push_token(t); + token_start = cursor; + continue; + } + +XINTEGER { + ts.push_token (Token (Token::XInteger, lineno, + token_start, cursor)); + token_start = cursor; + + continue; + } + +"pushr" { + ts.push_token (Token (Token::PushFrom, lineno)); + token_start = cursor; + + continue; + } +"push" { + ts.push_token (Token (Token::Push, lineno)); + token_start = cursor; + + continue; + } +"pop" { + ts.push_token (Token (Token::Pop, lineno)); + token_start = cursor; + + continue; + } +"popr" { + ts.push_token (Token (Token::PopTo, lineno)); + token_start = cursor; + + continue; + } + +"dup" { + ts.push_token (Token (Token::Dup, lineno)); + token_start = cursor; + + continue; + } + +"read" { + ts.push_token (Token (Token::Read, lineno)); + token_start = cursor; + + continue; + } + +"print" { + ts.push_token (Token (Token::Print, lineno)); + token_start = cursor; + + continue; + } + +"add" { + ts.push_token (Token (Token::Add, lineno)); + token_start = cursor; + + continue; + } + +"sub" { + ts.push_token (Token (Token::Sub, lineno)); + token_start = cursor; + + continue; + } + +"mul" { + ts.push_token (Token (Token::Mul, lineno)); + token_start = cursor; + + continue; + } + +"div" { + ts.push_token (Token (Token::Div, lineno)); + token_start = cursor; + + continue; + } + +"mod" { + ts.push_token (Token (Token::Mod, lineno)); + token_start = cursor; + + continue; + } + +"jmpt" { + ts.push_token (Token (Token::JumpT, lineno)); + token_start = cursor; + + continue; + } + +"jmpf" { + ts.push_token (Token (Token::JumpF, lineno)); + token_start = cursor; + + continue; + } + +"jmp" { + ts.push_token (Token (Token::Jump, lineno)); + token_start = cursor; + + continue; + } +"const" { + ts.push_token (Token (Token::Const, lineno)); + token_start = cursor; + + continue; + } + +"string" { + ts.push_token (Token (Token::String, lineno)); + token_start = cursor; + + continue; + } + +"call" { + ts.push_token (Token (Token::Call, lineno)); + token_start = cursor; + + continue; + } + +"ret" { + ts.push_token (Token (Token::Ret, lineno)); + token_start = cursor; + + continue; + } + +"leq" { + ts.push_token (Token (Token::LessEq, lineno)); + token_start = cursor; + + continue; + } +"less" { + ts.push_token (Token (Token::Less, lineno)); + token_start = cursor; + + continue; + } + +"label" { + ts.push_token (Token (Token::Label, lineno)); + token_start = cursor; + + continue; + } + +IDENTIFIER { + ts.push_token (Token (Token::Ident, lineno, token_start, + cursor)); + token_start = cursor; + + continue; + } +SSTRING | DSTRING { + ts.push_token (Token (Token::StringValue, lineno, token_start + 1, + cursor - 1)); + token_start = cursor; + + continue; + } + +[ ]+ { + token_start = cursor; + + continue; + } +DIGIT* ":" { + token_start = cursor; + + continue; + } +"#" .* "\n" { + ++lineno; + token_start = cursor; + + continue; + } +"\n" { + ++lineno; + token_start = cursor; + + continue; + } + +"\000" { + ts.push_token (Token (Token::EndInput, lineno)); + + break; + } + +[^] { + return false; + } + +*/ + } + return true; + } + +/*! +** Fills up the buffer when neccessary. +** Note the buffer is always filled to the maximum, not just the +** number of bytes neccessary for the lexer to continue. +** +** \param nbytes - the number of bytes +*/ + +void Lexer::buffer_grow (size_t new_size) +{ + char *new_buffer = new char[new_size]; + + std::copy (buffer, limit, new_buffer); + + token_start = new_buffer + (token_start - buffer); + cursor = new_buffer + (cursor - buffer); + limit = new_buffer + new_size; + + buffer_size = new_size; + + delete [] buffer; + buffer = new_buffer; +} + +void Lexer::read (size_t nbytes) +{ + if (token_start + nbytes > limit) { // we need larger buffer + buffer_grow (token_start - buffer + nbytes); + } + + std::copy (token_start, limit, buffer); + cursor -= token_start - buffer; + char *old_limit = limit - (token_start - buffer); + token_start = buffer; + + file->read (old_limit, limit - old_limit); + if (file->eof ()) { + auto bytes = file->gcount (); + std::fill (old_limit + bytes, limit, '\0'); + } +} + +void Lexer::buffer_init () +{ + file->read (buffer, buffer_size); + if (file->eof ()) { + auto bytes = file->gcount (); + std::fill (buffer + bytes, buffer + buffer_size, '\0'); + } + + cursor = marker = token_start = buffer; + limit = buffer + buffer_size; +} + + +} // namespace Lexer + +} // namespace ASM +} // namespace SpasmImpl + diff --git a/spasm/src/asm/main.cpp b/spasm/src/asm/main.cpp new file mode 100644 index 0000000..2b33a12 --- /dev/null +++ b/spasm/src/asm/main.cpp @@ -0,0 +1,22 @@ +#include <fstream> +#include <iostream> +#include "assembler.hpp" + +int main(int argc, const char* argv[]) +{ + if (argc != 3) + return 1; + SpasmImpl::ASM::Bytecode_Memory bytecode; + std::ifstream input(argv[1]); + SpasmImpl::ASM::compile(input, bytecode); + + std::ofstream output(argv[2], std::ios_base::out | std::ios_base::binary); + + // output.write ("SPASM", 5); + auto& bc = bytecode.bytecode(); + auto size = bc.size(); + output.write(reinterpret_cast<const char*>(&size), sizeof(size)); + output.write(reinterpret_cast<const char*>(bc.data()), size); + + return 0; +} diff --git a/spasm/src/asm/symbol.cpp b/spasm/src/asm/symbol.cpp new file mode 100644 index 0000000..d434060 --- /dev/null +++ b/spasm/src/asm/symbol.cpp @@ -0,0 +1,121 @@ +#include <list> +#include <string> + +#include "symbol.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +const size_t Symbol::notdefined = 0xff; +// const size_t Symbol::notdefined = ~0ull; + +Symbol::Symbol() : _definition(notdefined) {} + +Symbol::Symbol(const std::string& identifier, size_t definition) + : _identifier(identifier), _definition(definition) +{ +} + +const std::string& Symbol::identifier() const +{ + return _identifier; +} + +size_t Symbol::definition() const +{ + return _definition; +} + +void Symbol::define(size_t definition) +{ + _definition = definition; +} + +size_t Symbol::add_position(size_t position) +{ + _positions.push_back(position); + + return _definition; +} + +Symbol::Positions_t::const_iterator Symbol::positions_begin() const +{ + return _positions.begin(); +} + +Symbol::Positions_t::const_iterator Symbol::positions_end() const +{ + return _positions.end(); +} + +Symbol_Table::Symbol_Table() {} + +/*! +** Search the table for symbol by identifier +** +** \param identifier - identifier of the symbol +** +** \return pointer to the symbol if it exists or NULL otherwise. +*/ +Symbol* Symbol_Table::find(const std::string& identifier) const +{ + const_iterator i = _table.find(identifier); + return (i != _table.end()) ? i->second : NULL; +} + +/*! +** Insert symbol with identifier indentifier on position position +** of just add new position for symbol. +** \param identifier - identifer of the symbol +** \param position - position of the symbol +** +** \return pointer to the symbol +*/ +Symbol* Symbol_Table::insert(const std::string& identifier, size_t position) +{ + Symbol* psymbol = find(identifier); + if (psymbol == NULL) + { + psymbol = new Symbol(identifier); + _table.insert(std::make_pair(identifier, psymbol)); + } + psymbol->add_position(position); + + return psymbol; +} + +/*! +** define symbol with identifier indentifier +** If the symbol already exists its definition is changed +** \param identifier - identifer of the symbol +** \param definition - definition of the symbol +** +** \return pointer to the symbol +*/ +Symbol* Symbol_Table::define(const std::string& identifier, size_t definition) +{ + Symbol* psymbol = find(identifier); + if (psymbol == NULL) + { + psymbol = new Symbol(identifier, definition); + _table.insert(std::make_pair(identifier, psymbol)); + } + else + psymbol->define(definition); + + return psymbol; +} + +Symbol_Table::const_iterator Symbol_Table::begin() const +{ + return _table.begin(); +} + +Symbol_Table::const_iterator Symbol_Table::end() const +{ + return _table.end(); +} + +} // namespace ASM +} // namespace SpasmImpl diff --git a/spasm/src/asm/symbol.hpp b/spasm/src/asm/symbol.hpp new file mode 100644 index 0000000..6ce4dbf --- /dev/null +++ b/spasm/src/asm/symbol.hpp @@ -0,0 +1,69 @@ +#ifndef SYMBOL_HPP +#define SYMBOL_HPP + +#include <list> +#include <map> +#include <string> + +namespace SpasmImpl +{ +namespace ASM +{ +//! Represents symbol table entry for the assembler +class Symbol +{ + public: + typedef std::list<size_t> Positions_t; + static const size_t notdefined; + Symbol(); + Symbol(const std::string&, size_t = 0); + + const std::string& identifier() const; + size_t definition() const; + + void define(size_t); + + size_t add_position(size_t); + + Positions_t::const_iterator positions_begin() const; + Positions_t::const_iterator positions_end() const; + + private: + //! identifier of the symbol + std::string _identifier; + + //! position of definition of the identifier + size_t _definition; + + //! list of uses of the identifier (positions) + Positions_t _positions; +}; + +//! This is the symbol table of the assembler +class Symbol_Table +{ + private: + typedef std::map<std::string, Symbol*> Table_t; + typedef Table_t::iterator iterator; + + public: + Symbol_Table(); + typedef Table_t::const_iterator const_iterator; + + Symbol* find(const std::string&) const; + Symbol* insert(const std::string&, size_t); + Symbol* define(const std::string&, size_t); + + const_iterator begin() const; + const_iterator end() const; + + private: + Symbol_Table(const Symbol_Table&); + Symbol_Table& operator=(const Symbol_Table&); + + Table_t _table; +}; +} // namespace ASM +} // namespace SpasmImpl + +#endif // SYMBOL_HPP diff --git a/spasm/src/asm/token.cpp b/spasm/src/asm/token.cpp new file mode 100644 index 0000000..7582892 --- /dev/null +++ b/spasm/src/asm/token.cpp @@ -0,0 +1,79 @@ +#include <memory> +#include <new> +#include <queue> +#include <string> + +#include "token.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +namespace Lexer +{ +Token::Token(Token_type type) + : _type(type), _lineno(0), _value_int(0), _value_str("") +{ +} + +Token::Token(Token::Token_type type, + size_t lineno, + const char* start, + const char* end) + : _type(type), _lineno(lineno) +{ + switch (_type) + { + case Integer: + case XInteger: + { + _value_int = strtol(start, NULL, 0); + break; + } + case FloatingPoint: + { + _value_double = strtod(start, NULL); + break; + } + case Ident: + case StringValue: + { + if (end) + { + _value_str = std::string(start, end); + } + else + { + _value_str = std::string(start); + } + break; + } + default: + break; + } +} + +Token::Token_type Token::type() const +{ + return _type; +} + +int64_t Token::value_int() const +{ + return _value_int; +} + +const std::string& Token::value_str() const +{ + return _value_str; +} + +size_t Token::lineno() const +{ + return _lineno; +} + +} // namespace Lexer + +} // namespace ASM +} // namespace SpasmImpl diff --git a/spasm/src/asm/token.hpp b/spasm/src/asm/token.hpp new file mode 100644 index 0000000..2e69108 --- /dev/null +++ b/spasm/src/asm/token.hpp @@ -0,0 +1,94 @@ +#ifndef TOKEN_HPP +#define TOKEN_HPP + +#include <string> + +namespace SpasmImpl +{ +namespace ASM +{ +namespace Lexer +{ +class Token +{ + public: + enum Token_type + { + _NoArgBegin, + Halt = _NoArgBegin, + Dup, + Pop, + _OneArgBegin, + PopTo = _OneArgBegin, + PushFrom, + Push, + Print, + Read, + Call, + Ret, + Jump, + _TwoArgBegin, + JumpT = _TwoArgBegin, + JumpF, + Const, + String, + _ThreeArgBegin, + Add = _ThreeArgBegin, + Sub, + Mul, + Div, + Mod, + Less, + LessEq, + _NotOpCodeBegin, + Label = _NotOpCodeBegin, + Ident, + // Register, + Integer, + XInteger, + FloatingPoint, + StringValue, + EndInput, + NotUsed + }; + + Token(Token_type = NotUsed); + + Token(Token_type, size_t, const char* = NULL, const char* = NULL); + + Token_type type() const; + + size_t lineno() const; + + int64_t value_int() const; + void set_int(int64_t v) { _value_int = v; } + + double value_double() const { return _value_double; } + + const std::string& value_str() const; + + private: + Token_type _type; + + size_t _lineno; + + int64_t _value_int; + double _value_double; + + std::string _value_str; +}; + +class TokenStream +{ + public: + virtual void push_token(const Token&) = 0; + virtual ~TokenStream(){}; +}; + +} // namespace Lexer +} // namespace ASM +} // namespace SpasmImpl + +#undef TOKENS + +#endif diff --git a/spasm/src/asm/tokenizer.cpp b/spasm/src/asm/tokenizer.cpp new file mode 100644 index 0000000..b394da9 --- /dev/null +++ b/spasm/src/asm/tokenizer.cpp @@ -0,0 +1,51 @@ +#include <iostream> +#include <memory> +#include <new> + +#include "lexer.hpp" +#include "token.hpp" +#include "tokenizer.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +namespace Lexer +{ +Tokenizer::Tokenizer(std::istream& istr) + : _lexer(new Lexer(istr, 1024)), end_input(false) +{ + _lexer->buffer_init(); +} + +void Tokenizer::push_token(const Token& token) +{ + _tokens.push(token); + if (token.type() == Token::EndInput) + end_input = true; +} + +Token Tokenizer::next_token() +{ + Token t(Token::EndInput); + if (!_tokens.empty()) + { + t = _tokens.front(); + _tokens.pop(); + } + else if (!end_input) + { + while (_tokens.empty()) + { + _lexer->read(); + _lexer->tokenize(*this); + } + t = _tokens.front(); + _tokens.pop(); + } + return t; +} + +} // namespace Lexer +} // namespace ASM +} // namespace SpasmImpl diff --git a/spasm/src/asm/tokenizer.hpp b/spasm/src/asm/tokenizer.hpp new file mode 100644 index 0000000..7bfc814 --- /dev/null +++ b/spasm/src/asm/tokenizer.hpp @@ -0,0 +1,35 @@ +#ifndef TOKENIZER_HPP +#define TOKENIZER_HPP + +#include <iostream> +#include <memory> +#include <queue> + +#include "lexer.hpp" +#include "token.hpp" + +namespace SpasmImpl +{ +namespace ASM +{ +namespace Lexer +{ +class Tokenizer : public TokenStream +{ + public: + Tokenizer(std::istream&); + + void push_token(const Token&) override; + Token next_token(); + + private: + std::unique_ptr<Lexer> _lexer; + std::queue<Token> _tokens; + bool end_input; +}; // class Tokenizer +} // namespace Lexer + +} // namespace ASM +} // namespace SpasmImpl + +#endif diff --git a/spasm/src/main.cpp b/spasm/src/main.cpp new file mode 100644 index 0000000..7c423cb --- /dev/null +++ b/spasm/src/main.cpp @@ -0,0 +1,34 @@ +#include <fstream>
+#include <iostream>
+
+#include <memory>
+#include "spasm.hpp"
+
+int main(int argc, const char* argv[])
+{
+ if (argc != 2)
+ return 1;
+
+ std::ifstream input(argv[1], std::ios_base::in | std::ios_base::binary);
+
+ size_t len;
+
+ input.read((char*)&len, sizeof(len));
+
+ std::unique_ptr<Spasm::byte[]> bytecode(new Spasm::byte[len]);
+
+ input.read((char*)bytecode.get(), len);
+
+ for (size_t i = 0; i < len; ++i)
+ std::cout << std::hex << (int)bytecode[i] << ' ';
+ std::cout << std::endl;
+
+ Spasm::Spasm vm;
+ vm.Initialize(len, bytecode.get());
+
+ vm.run();
+
+ std::cout << std::endl;
+
+ return 0;
+}
diff --git a/spasm/src/program.spa b/spasm/src/program.spa new file mode 100644 index 0000000..d3149a1 --- /dev/null +++ b/spasm/src/program.spa @@ -0,0 +1,12 @@ +read +label next +dup +push 1 +< +jmpt bye +push 1 +- +dup +print +jmp next +label bye diff --git a/spasm/src/spasm.cpp b/spasm/src/spasm.cpp new file mode 100644 index 0000000..94086a6 --- /dev/null +++ b/spasm/src/spasm.cpp @@ -0,0 +1,517 @@ +#include <algorithm> +#include <cassert> +#include <iostream> + +#include "spasm.hpp" + +namespace SpasmImpl +{ +Spasm::Spasm() {} + +/*! +** Constructs new Spasm object +** +** \param _bc_size - size/length of the bytecode +** \param _bytecode - the bytecode of the program +** \param _istr - input stream for the machine +** \param _ostr - output stream for the machine +*/ +void Spasm::Initialize(PC_t _bc_size, + const byte* _bytecode, + std::istream& _istr, + std::ostream& _ostr) + +{ + m_PC = 0; + m_ByteCode.assign(_bytecode, _bytecode + _bc_size); + istr = &_istr; + ostr = &_ostr; + data_stack.resize(1024); + m_SP = &data_stack[0]; + m_FP = &data_stack[0]; +} + +Spasm::~Spasm() {} + +/*! +** Runs the machine. The machine stops if it reaches an invalid opcode +** or opcode 0 or the pc reaches beyond the end of the bytecode. +** @return error code for success or failure +*/ +Spasm::RunResult Spasm::run() +{ + const auto codeSize = m_ByteCode.size(); + while (m_PC < codeSize) + { + const auto instruction = m_ByteCode[m_PC++]; + const auto opcode = OpCodes(instruction & 0x3f); + const auto size = instruction >> 6; + switch (opcode) + { + case OpCodes::Halt: + return RunResult::Success; + case OpCodes::Dup: + dup(); + break; + case OpCodes::Pop: + { + const auto count = PC_t(read_reg(size)); + assert(m_SP - count >= m_FP); + m_SP -= count; + break; + } + case OpCodes::PopTo: + { + const auto arg0 = read_reg(size); + popto(arg0); + break; + } + case OpCodes::PushFrom: + { + const auto arg0 = read_reg(size); + push(arg0); + break; + } + case OpCodes::Push: + { + const auto count = PC_t(read_reg(size)); + assert(m_SP + count <= &data_stack[data_stack.size() - 1]); + std::fill(m_SP, m_SP + count, data_t{}); + m_SP += count; + break; + } + case OpCodes::Print: + { + const auto arg0 = read_reg(size); + print(arg0); + break; + } + case OpCodes::Read: + { + const auto arg0 = read_reg(size); + read(arg0); + break; + } + case OpCodes::Call: + { + const auto arg0 = read_reg(size); + call(arg0); + break; + } + case OpCodes::Ret: + { + const auto arg0 = read_reg(size); + ret(arg0); + break; + } + case OpCodes::Jump: + { + const auto arg0 = read_reg(size); + go(arg0); + break; + } + case OpCodes::JumpT: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + gotrue(arg0, arg1); + break; + } + case OpCodes::JumpF: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + gofalse(arg0, arg1); + break; + } + case OpCodes::Const: + { + const auto reg = read_reg(size); + const auto value = read_number(size); + set_local(reg, value); + break; + } + case OpCodes::String: + { + const auto reg = read_reg(size); + const auto value = read_string(size); + set_local(reg, value); + break; + } + case OpCodes::Add: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + plus(arg0, arg1, arg2); + break; + } + case OpCodes::Sub: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + minus(arg0, arg1, arg2); + break; + } + case OpCodes::Mul: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + multiply(arg0, arg1, arg2); + break; + } + case OpCodes::Div: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + divide(arg0, arg1, arg2); + break; + } + case OpCodes::Mod: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + modulus(arg0, arg1, arg2); + break; + } + case OpCodes::Less: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + less(arg0, arg1, arg2); + break; + } + case OpCodes::LessEq: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + lesseq(arg0, arg1, arg2); + break; + } + case OpCodes::Greater: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + greater(arg0, arg1, arg2); + break; + } + case OpCodes::GreaterEq: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + greatereq(arg0, arg1, arg2); + break; + } + case OpCodes::Equal: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + equal(arg0, arg1, arg2); + break; + } + case OpCodes::NotEqual: + { + const auto arg0 = read_reg(size); + const auto arg1 = read_reg(size); + const auto arg2 = read_reg(size); + not_equal(arg0, arg1, arg2); + break; + } + default: + { + std::cerr << opcode << ": not implemented" << std::endl; + return RunResult::NotImplemented; + } + } + } + return RunResult::Success; +} + +/*! +** Pushes the next data_t object on the data stack +*/ +void Spasm::push(reg_t reg) +{ + push_data(get_local(reg)); +} + +void Spasm::popto(reg_t reg) +{ + m_FP[reg] = *(--m_SP); +} + +/*! +** Dups the data_t object on top of the data stack. +*/ +void Spasm::dup() +{ + push_data(*(m_SP - 1)); +} + +/*! +** Reads a data_t object from the input stream and pushes it on the data +** stack. +*/ +void Spasm::read(reg_t reg) +{ + data_t x; + *istr >> x; + set_local(reg, x); +} + +/*! +** Pops a data_t object from the data stack and prints it on the output +** stream. +*/ +void Spasm::print(reg_t reg) +{ + *ostr << get_local(reg); +} + +/*! +** Pops two data objects from the data stack and pushes their sum on the +** data stack. +*/ +void Spasm::plus(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) + get_local(a2)); +} + +/*! +** Pops two data objects from the data stack and pushes their difference +** on the data stack. +*/ +void Spasm::minus(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) - get_local(a2)); +} + +/*! +** Pops two data objects from the data stack and pushes their product +** on the data stack. +*/ +void Spasm::multiply(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) * get_local(a2)); +} + +/*! +** Pops two data objects from the data stack and pushes their division +** on the data stack. +*/ +void Spasm::divide(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) / get_local(a2)); +} + +/*! +** Pops two data objects from the data stack and pushes their modulus +** on the data stack. +*/ +void Spasm::modulus(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) % get_local(a2)); +} + +/*! +** Conditional execution. +** If the data_t object on top of the data stack evaluates to true +** execution continues from the place pointed by number in the next bytes +*/ +void Spasm::gotrue(reg_t a0, reg_t a1) +{ + if (get_local(a0)) + { + go(a1); + } +} + +/*! +** Conditional execution. +** If the data_t object on top of the data stack evaluates to false +** execution continues from the place pointed by number in the next bytes +*/ +void Spasm::gofalse(reg_t a0, reg_t a1) +{ + if (!get_local(a0)) + { + go(a1); + } +} + +/*! +** Unconditional execution. +** Execution continues from the opcode pointed by the next bytes +*/ +void Spasm::go(reg_t a0) +{ + m_PC = PC_t(a0); +} + +/*! +** Function call. A new frame with the specified size is created, the +** return address is saved in the return stack and the new pc is loaded. +*/ +void Spasm::call(reg_t a0) +{ + Frame call{m_PC, PC_t(m_FP - &data_stack[0]), + m_SP - &data_stack[0] - PC_t((*(m_SP - 1)).get_double()) - 1}; + m_Frames.push(std::move(call)); + m_FP = m_SP - 1; + go(a0); +} + +/*! +** Function return. The frame of the current function is destroyed and the +** saved return address is loaded in the pc +*/ +void Spasm::ret(reg_t reg) +{ + Frame parent = m_Frames.top(); + m_Frames.pop(); + m_SP = &data_stack[parent.StackPointer]; + *(m_SP - 1) = m_FP[reg]; + m_FP = &data_stack[parent.FramePointer]; + m_PC = parent.ReturnAddress; +} + +/*! +** Local variable with index top of the data stack is pushed on top of the +** data stack. +*/ +void Spasm::load() +{ + assert(false && "not-implemented"); +} + +/*! +** Local variable is assigned value +*/ +void Spasm::store() +{ + assert(false && "not-implemented"); +} + +/*! +** Compares the values on top of the stack. Pushes 1 if the value before +** the top of the stack is less than that on top of the stack. +*/ +void Spasm::less(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) < get_local(a2)); +} + +/*! +** Compares the values on top of the stack. Pushes 1 if the value before +** the top of the stack is less than or equal to that on top of the stack. +*/ +void Spasm::lesseq(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) <= get_local(a2)); +} + +void Spasm::greater(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) > get_local(a2)); +} + +void Spasm::greatereq(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) >= get_local(a2)); +} + +void Spasm::equal(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) == get_local(a2)); +} + +void Spasm::not_equal(reg_t a0, reg_t a1, reg_t a2) +{ + set_local(a0, get_local(a1) != get_local(a2)); +} + +data_t Spasm::get_local(reg_t reg) +{ + assert(&data_stack[0] <= (m_FP + reg)); + assert((m_FP + reg) < &data_stack[data_stack.size() - 1]); + return m_FP[reg]; +} + +void Spasm::set_local(reg_t reg, data_t data) +{ + assert(&data_stack[0] <= (m_FP + reg)); + assert((m_FP + reg) < &data_stack[data_stack.size() - 1]); + m_FP[reg] = data; +} + +data_t Spasm::pop_data() +{ + auto result = data_stack.back(); + data_stack.pop_back(); + return result; +} + +void Spasm::push_data(data_t data) +{ + assert(m_SP < &data_stack[data_stack.size() - 1]); + *(m_SP++) = data; +} + +reg_t Spasm::read_reg(size_t size) +{ + return read_integer(size); +} + +data_t Spasm::read_number(size_t size) +{ + return data_t(double(read_integer(size))); +} + +int64_t Spasm::read_integer(size_t size) +{ + switch (size) + { + case 0: + return m_ByteCode[m_PC++]; + case 1: + { + auto result = *reinterpret_cast<int16_t*>(&m_ByteCode[0] + m_PC); + m_PC += 2; + return result; + } + case 2: + { + auto result = *reinterpret_cast<int32_t*>(&m_ByteCode[0] + m_PC); + m_PC += 4; + return result; + } + case 3: + { + auto result = *reinterpret_cast<int64_t*>(&m_ByteCode[0] + m_PC); + m_PC += 8; + return result; + } + } + assert(false && "not reached"); + return 0; +} + +data_t Spasm::read_string(size_t size) +{ + const auto length = size_t(read_integer(size)); + const auto s = reinterpret_cast<const char*>(&m_ByteCode[m_PC]); + m_PC += length; + const auto value = m_Strings.Get(s, length); + return data_t(::Spasm::ValueType::String, (void*)value); +} + +} // namespace SpasmImpl diff --git a/spasm/src/spasm.hpp b/spasm/src/spasm.hpp new file mode 100644 index 0000000..da3f44f --- /dev/null +++ b/spasm/src/spasm.hpp @@ -0,0 +1,15 @@ +#ifndef SPASM_HPP
+#define SPASM_HPP
+
+#include "spasm_impl.hpp"
+#include "value.hpp"
+
+namespace Spasm
+{
+using SpasmImpl::byte;
+using SpasmImpl::OpCodes;
+using SpasmImpl::PC_t;
+using SpasmImpl::Spasm;
+} // namespace Spasm
+
+#endif // #ifndef SPASM_HPP
diff --git a/spasm/src/spasm_impl.hpp b/spasm/src/spasm_impl.hpp new file mode 100644 index 0000000..04e809a --- /dev/null +++ b/spasm/src/spasm_impl.hpp @@ -0,0 +1,164 @@ +#ifndef SPASM_IMPL_HPP +#define SPASM_IMPL_HPP + +#include <iostream> + +#include <unordered_set> +#include "types.hpp" + +namespace SpasmImpl +{ +enum OpCodes : char +{ + Halt, + Dup, + Pop, + PopTo, + PushFrom, + Push, + Print, + Read, + Call, + Ret, + Jump, + JumpT, + JumpF, + Const, + String, + Add, + Sub, + Mul, + Div, + Mod, + Less, + LessEq, + Greater, + GreaterEq, + Equal, + NotEqual, + LastIndex = NotEqual, +}; +static_assert(LastIndex < 0x3f, "Too many opcodes"); + +class StringTable +{ + public: + const SPStringValue* Get(const char* s, size_t length) + { + SPString v(s, length); + auto pos = m_Strings.insert(SPStringValue(v)); + return &(*pos.first); + } + + private: + typedef std::unordered_set<SPStringValue> StringMap; + StringMap m_Strings; +}; + +//! The Abstract Stack Machine +/*! +** The machine contains a data stack for operations and control flow and +** frame stack for function calls (including parameter passing) and local +** variables and return stack for the addresses of the returns. +*/ +class Spasm +{ + public: + Spasm(); + void Initialize(PC_t, + const byte*, + std::istream& = std::cin, + std::ostream& = std::cout); + ~Spasm(); + Spasm(const Spasm&) = delete; + Spasm& operator=(const Spasm&) = delete; + + enum RunResult + { + Success, + Exception, + NotImplemented, + }; + RunResult run(); + + private: + //! Program counter - points the current opcode + PC_t m_PC = 0; + + typedef SPVector<byte> ByteCode; + //! bytecode of the program + ByteCode m_ByteCode; + + typedef SPVector<data_t> DataStack; + //! stack for storing arguments and local variables + DataStack data_stack; + + //! Stack pointer - always the top of the stack + data_t* m_SP = nullptr; + + //! Frame pointer - the start of the stack for the current function + data_t* m_FP = nullptr; + + struct Frame + { + PC_t ReturnAddress; + PC_t FramePointer; + PC_t StackPointer; + }; + + typedef std::stack<Frame> FrameStack; + //! Stack for function frames + FrameStack m_Frames; + + StringTable m_Strings; + + //! Input stream for read () operation + std::istream* istr; + + //! Output stream for print () opertion + std::ostream* ostr; + + void push(reg_t reg); + void popto(reg_t reg); + void dup(); + + void print(reg_t reg); + void read(reg_t reg); + + void plus(reg_t a0, reg_t a1, reg_t a2); + void minus(reg_t a0, reg_t a1, reg_t a2); + void multiply(reg_t a0, reg_t a1, reg_t a2); + void divide(reg_t a0, reg_t a1, reg_t a2); + void modulus(reg_t a0, reg_t a1, reg_t a2); + + void gotrue(reg_t a0, reg_t a1); + void gofalse(reg_t a0, reg_t a1); + void go(reg_t a0); + + void call(reg_t a0); + void ret(reg_t a0); + + void load(); + void store(); + + void less(reg_t a0, reg_t a1, reg_t a2); + void lesseq(reg_t a0, reg_t a1, reg_t a2); + + void greater(reg_t a0, reg_t a1, reg_t a2); + void greatereq(reg_t a0, reg_t a1, reg_t a2); + + void equal(reg_t a0, reg_t a1, reg_t a2); + void not_equal(reg_t a0, reg_t a1, reg_t a2); + + data_t get_local(reg_t reg); + void set_local(reg_t reg, data_t data); + data_t pop_data(); + void push_data(data_t); + reg_t read_reg(size_t size); + data_t read_number(size_t size); + int64_t read_integer(size_t size); + data_t read_string(size_t size); +}; + +} // namespace SpasmImpl +#endif // #ifndef SPASM_IMPL_HPP diff --git a/spasm/src/string.hpp b/spasm/src/string.hpp new file mode 100644 index 0000000..8ffb214 --- /dev/null +++ b/spasm/src/string.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include <string> + +namespace SpasmImpl +{ +typedef std::string SPString; + +class SPStringValue +{ + public: + explicit SPStringValue(SPString s) : m_Value(std::move(s)) {} + + SPStringValue(const SPStringValue&) = delete; + SPStringValue(SPStringValue&&) = default; + SPStringValue& operator=(const SPStringValue&) = delete; + SPStringValue& operator=(SPStringValue&&) = default; + + const SPString& GetValue() const { return m_Value; } + + bool operator==(const SPStringValue& rhs) const + { + return m_Value == rhs.m_Value; + } + + bool operator==(const SPString& rhs) const { return m_Value == rhs; } + + private: + SPString m_Value; +}; +} // namespace SpasmImpl + +namespace std +{ +template <> +struct hash<SpasmImpl::SPStringValue> +{ + size_t operator()(const SpasmImpl::SPStringValue& v) const + { + return std::hash<SpasmImpl::SPString>{}(v.GetValue()); + } +}; +} // namespace std
\ No newline at end of file diff --git a/spasm/src/types.hpp b/spasm/src/types.hpp new file mode 100644 index 0000000..a5d45d8 --- /dev/null +++ b/spasm/src/types.hpp @@ -0,0 +1,24 @@ +#ifndef TYPES_HPP +#define TYPES_HPP + +#include <cstdlib> +#include <stack> +#include <vector> + +#include "value.hpp" + +namespace SpasmImpl +{ +typedef int8_t byte; +typedef size_t PC_t; +typedef Spasm::Value data_t; + +class Spasm; +typedef void (Spasm::*Operation)(); + +template <typename T> +using SPVector = std::vector<T>; + +typedef long long int reg_t; +} // namespace SpasmImpl +#endif // ----- #ifndef TYPES_HPP diff --git a/spasm/src/value.hpp b/spasm/src/value.hpp new file mode 100644 index 0000000..725d48c --- /dev/null +++ b/spasm/src/value.hpp @@ -0,0 +1,175 @@ +#pragma once + +#include <cassert> +#include "string.hpp" + +namespace Spasm +{ +enum class ValueType +{ + Number, + Null, + Undefined, + Boolean, + String, + Array, + Object, + Function, +}; + +static_assert(int(ValueType::Function) < 8, "Too many types"); + +struct Value +{ + Value() { m_value.as_double = 0.0; } + + explicit Value(double v) { m_value.as_double = v; } + + explicit Value(bool v) : Value(ValueType::Boolean, (uint64_t)v) {} + + Value(ValueType tag, uint64_t payload) + { + assert(tag != ValueType::Number && "Zero tag is plain double"); + assert(!(payload >> 48) && "Use only pointers to the heap."); + m_value.as_pointer.pointer = payload; + m_value.as_pointer.tag = uint64_t(tag); + m_value.as_pointer.nan = 0x1fff; + } + + Value(ValueType tag, void* pointer) : Value(tag, (uint64_t)pointer) {} + + struct NanPointer + { + uint64_t pointer : 48; + uint64_t tag : 3; + uint64_t nan : 13; + }; + + struct CheckType + { + uint64_t payload : 48; + uint64_t check : 16; + }; + union { + double as_double; + NanPointer as_pointer; + CheckType to_check; + uint64_t as_int64; + } m_value; + + static_assert(sizeof(double) == 8, "unsupported arch"); + + bool is_double() const { return m_value.to_check.check <= 0xFFF8; } + + double get_double() const + { + assert(is_double()); + return m_value.as_double; + } + + ValueType get_type() const + { + return is_double() ? ValueType::Number + : ValueType(m_value.as_pointer.tag); + } + + void* get_pointer() const + { + return (void*)(uint64_t)m_value.as_pointer.pointer; + } + + bool get_boolean() const + { + assert(get_type() == ValueType::Boolean); + return m_value.as_pointer.pointer != 0; + } + + explicit operator bool() const + { + // NaN will be true. Assume that is ok. + return (get_type() != ValueType::Boolean && m_value.as_int64 != 0) || + get_boolean(); + } +}; + +inline std::istream& operator>>(std::istream& input, Value& value) +{ + return input >> value.m_value.as_double; +} + +inline std::ostream& operator<<(std::ostream& output, const Value& value) +{ + switch (value.get_type()) + { + case ValueType::Number: + return output << value.m_value.as_double; + case ValueType::Boolean: + return output << bool(value); + case ValueType::String: + { + const auto s = static_cast<const SpasmImpl::SPStringValue*>( + value.get_pointer()); + return output << s->GetValue(); + } + default: + break; + } + return output; +} + +inline Value operator+(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() + rhs.get_double()); +} + +inline Value operator-(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() - rhs.get_double()); +} + +inline Value operator*(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() * rhs.get_double()); +} + +inline Value operator/(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() / rhs.get_double()); +} + +inline Value operator%(const Value& lhs, const Value& rhs) +{ + return Value(double(int64_t(lhs.get_double()) % int64_t(rhs.get_double()))); +} + +inline Value operator<(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() < rhs.get_double()); +} + +inline Value operator>(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() > rhs.get_double()); +} + +inline Value operator<=(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() <= rhs.get_double()); +} + +inline Value operator>=(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() >= rhs.get_double()); +} + +inline Value operator==(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() == rhs.get_double()); +} + +inline Value operator!=(const Value& lhs, const Value& rhs) +{ + return Value(lhs.get_double() != rhs.get_double()); +} + +} // namespace Spasm |
