Skip to content

smol-lang/smol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smol

use OCaml now

Authors/Maintainers:

  • 22125113 - Nguyen Quang Truong
  • 22125078 - Dinh Cao Minh Quan
  • 22125121 - Dinh Hoang Viet
  • 22125051 - Pham Phu Loi

we vibe code a smol ocaml based language

Features

  • Variables
  • Functions
    • Recursion
    • Mutual Recursion
    • Higher order functions
    • Closures
  • Basic integer arithmetic operations (+, -, *, /, mod)
  • Basic boolean operations (&&, ||, !, =, <>, <, >, <=, >=)
  • Control flow
  • Hindley-Milner type inference
    • Concrete types (int, bool, (), function types)
    • Polymorphic types

Installation

  • Install OCaml
  • Clone this repository and enter the directory
  • Create an OPAM switch (we use 5.3.0, but older versions should work as well)
    opam switch create . ocaml-base-compiler.5.3.0
  • Install dependencies
    opam install . --deps-only
  • Build the project
    dune build
  • Run the project
    dune exec smol <path-to-file>

Examples

See the examples/ directory for example programs.

For example, to compile examples/1.ml:

dune exec smol examples/1.ml

About

a small ocaml-subset interpreter

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •