Kaynağa Gözat

doc: add info about zkas arch

x 3 yıl önce
ebeveyn
işleme
435f25491c
2 değiştirilmiş dosya ile 13 ekleme ve 0 silme
  1. 2 0
      bin/zkas/src/main.rs
  2. 11 0
      doc/src/zkas/zkas.md

+ 2 - 0
bin/zkas/src/main.rs

@@ -53,6 +53,7 @@ fn main() {
     // Clean up tabs, and convert CRLF to LF.
     let source = source.replace('\t', "    ").replace("\r\n", "\n");
 
+    // ANCHOR: zkas
     // The lexer goes over the input file and separates its content into
     // tokens that get fed into a parser.
     let lexer = Lexer::new(filename, source.chars());
@@ -93,6 +94,7 @@ fn main() {
     );
 
     let bincode = compiler.compile();
+    // ANCHOR_END: zkas
 
     let output = match args.output {
         Some(o) => o,

+ 11 - 0
doc/src/zkas/zkas.md

@@ -14,3 +14,14 @@ The
 [`main.rs`](https://github.com/darkrenaissance/darkfi/blob/master/bin/zkas/src/main.rs)
 file shows how this toolchain is put together to produce binary code
 from source code.
+
+# Architecture
+
+The main part of the compilation happens inside the parser. New opcodes
+can be added by extending
+[`opcode.rs`](https://github.com/darkrenaissance/darkfi/blob/master/src/zkas/opcode.rs).
+
+```rust
+{{#include ../../../bin/zkas/src/main.rs:zkas}}
+```
+