Giter VIP home page Giter VIP logo

go_monkey's Introduction

go_monkey

I got my hands dirty while reading the book "Writing an interpreter in Go".

And then I'm done with "Writing a Compiler in Go". I think it would be great to have more illustrations about the concepts and the layout of the instructions and the stack.

  • Lexer that distills the meaning of human readable source code into more essential form that arranges tokens which are defined and given its own meaning in the programming language.
  • Parser that transforms source codes(tokens lexed by Lexer) to AST structure. Here, Top down operator precedence parser (a.k.a. Pratt parser) is picked up and implemented.
  • AST (Abstract Syntax Tree)
  • Interpreter that traverses the AST and evaluates (executes) it on the fly.
  • Compiler that traverses the AST and generates the corresponding bytecode containing instructions, each instruction is made up of a opcode and one or two operands, or no operands at all. Jump instruction to implement conditionals.
  • Stack based virtual machine that executes the bytecode and do stack arithmetic and so forth using a stack. Keeping track of variable bindings, global or local ones (variable scopes). Call stack and frame to execute function call and manage stuff around it such as arguments to the function call and the function's local variables, the return address where the execution flow will get back after the currently executing function finishes.
  • Closure, free variable. Recursive funcition call, function that calls itself inside it.

go_monkey's People

Contributors

fumi76 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.