Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An interpreter for Hammer, a dynamically-typed, expression-based language, largely inspired by CLox

License

NotificationsYou must be signed in to change notification settings

shelter-kytty/hammer-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An interpreter for Hammer, a dynamically-typed, expression-oriented language that is somewhat functional.

The interpreter is, at its core, an implementation of the intepreter for CLox, an imperative language with OOP features and dynamic typing, designed and implemented by Bob Nystrom for his excellent book Crafting Interpreters, which can be foundhere, which links to a page of several other implementations just like this one!The book itself is an excellent resource and one of my favourites.

Whats different?

In addition, Hammer contains changes such as:

  • Using an AST in combination with the bytecode interpreter to allow for additional optimisations and features, while simplifying both in isolation
  • Makes use of Tail-Call Optimisation
  • A lack of OOP features, namely classes
  • Records akin to Pythonsdict, and Lists which support adding members
  • An extended set of builtin functions and features such as format strings/printing, custom operators, function composition, cons cells and more
  • Near-completely different syntax, favouring simple operators and semantics over keywords
  • A pivot towards expressions; all expression-statements return "something", loops are expressed through recursion, etc.
  • An extended feature set for implementation, such as support for variadic native functions and for calling non-/native functions with native ones.

Build

Hammer can be built withmake using gcc, it has targets for release and debug; for a first build run:

$ make all

To guarantee the existence of the build directories.

A note

This project is what really got me into low-level programming and comfortable with languages like C. I'd never written anything to this complexity until this project. HUGE thankyous to Bob Nystrom and the other talented programmers making and publishing their own implementations for others to see. Youre legends!

About

An interpreter for Hammer, a dynamically-typed, expression-based language, largely inspired by CLox

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp