https://github.com/cedrickchee/hou

Hou :monkey: programming language interpreter and compiler

https://github.com/cedrickchee/hou

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.6%) to scientific vocabulary

Keywords

abstract-syntax-tree bytecode compiler evaluator interpreter lexer parser programming-language
Last synced: 5 months ago · JSON representation

Repository

Hou :monkey: programming language interpreter and compiler

Basic Info
  • Host: GitHub
  • Owner: cedrickchee
  • License: mit
  • Language: Go
  • Default Branch: master
  • Homepage:
  • Size: 64.5 KB
Statistics
  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
abstract-syntax-tree bytecode compiler evaluator interpreter lexer parser programming-language
Created almost 6 years ago · Last pushed almost 6 years ago
Metadata Files
Readme License

README.md

Hou :monkey:

The Hou programming language based on Monkey, but with a little twist on the syntax and features.

Hou ("Monkey" in Chinese).

About this Project

My go-to project for practicing a new programming language is: - Thorsten Ball's writing on interpreters (https://interpreterbook.com) and compilers (https://compilerbook.com) - Bob Nystrom's Crafting Interpreters handbook for making programming languages

I reimplemented Monkey tree-walking interpreter in Go as a learning exercise. The code in this repository closely resembles that presented in Thorsten's book. The interpreter is fully working.

Don't miss out the step-by-step walk-through in this project, where each commit is a fully working part. Read the books and follow along with the commit history.

Quick start

Start the REPL:

```sh $ go get github.com/cedrickchee/hou $ hou This is the Hou programming language! Feel free to type in commands

```

Then entering some Hou code:

  • Variable bindings

```sh

let name = "awesome people" puts("Hello " + name) Hello awesome people null ```

  • Functions and closures

```sh

let newAdder = fn(x) { fn(y) { x + y } }; let addTwo = newAdder(2); addTwo(3); 5 ```

  • Arrays and hash maps

```sh

let music = [{"song": "We are the World", "singer": "Michael Jackson", "year": 1985}, {"song": "Help!", "singer": "The Beatles", "year": 1965}] music[0] {song: We are the World, singer: Michael Jackson, year: 1985} music[1]["song"] Help! ```

  • Errors

```

color = "green" , .--. .-" "-. .--. / .. \/ .-. .-. \/ .. \ | | '| / Y \ |' | | | \ \ \ 0 | 0 / / / | \ '- ,.-"""""""-./, -' / ''-' /_ ^ ^ \ '-'' | . ./ | \ \ '~' / / '. '-=-' _.' '-----' Woops! We ran into some monkey business here! parser errors: no prefix parse function for = found ```

Development

To build, run make.

sh $ git clone https://github.com/cedrickchee/hou $ cd hou $ make

To run the tests, run make test.

Step-by-step walk-through

Writing an Interpreter

Owner

  • Name: Cedric Chee
  • Login: cedrickchee
  • Kind: user
  • Location: PID 1
  • Company: InvictusByte

Lead Software Engineer | LLMs | full stack Go/JS dev, backend | product dev @ startups | 🧑‍🎓 CompSci | alumni: fast.ai, Antler.co

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 0
proxy.golang.org: github.com/cedrickchee/hou
  • Versions: 0
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 7.2%
Dependent repos count: 7.5%
Last synced: 6 months ago