Git Product home page Git Product logo

monkey's Introduction

monkey

Learn writing an interpreter in go and writing a compiler in go. Implement a monkey programming language.

Features

  • Monkey is a REPL(Read Eval Print Loop) programming language, e.g. Python.
  • The parser we write is a recursive descent parser.

There are two main strategies when parsing a programming language: top-down parsing or bottom-up parsing. “Recursive descent parsing” is a variant of top-down parsing.

  • Use Pratt parser to parsing expressions.

A Pratt parser’s main idea is the association of parsing functions (which Pratt calls “semantic code”) with token types.

  • We will build a tree-walking interpreter and evaluate on the fly.
  • We will be represented every value as an object, an interface of our design. Every value will be wrapped inside a struct, which fulfills this Object interface.

Terminology

  • lexical analysis, lexing or tokenization: is the process of converting a sequence of characters into a sequence of lexical tokens.
  • parser: A parser is a software component that takes input data (frequently text) and builds a data structure – often some kind of parse tree, abstract syntax tree(AST) or other hierarchical structure – giving a structural representation of the input, checking for correct syntax in the process. The parser is often preceded by a separate lexical analyser, which creates tokens from the sequence of input characters.

monkey's People

Contributors

zh1c avatar

Watchers

 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.