Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compilation (--compile ...) works #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thanhnguyen2187
Copy link
Owner

@thanhnguyen2187 thanhnguyen2187 commented Jul 12, 2023

The end result is to make Camlisp able to compile arbitrary Scheme expressions from input file(s) to working OCaml code in a .ml file. For example, this Scheme function:

(define (fact-iter n)
   (define (iter result n)
     (if (= n 1)
       result
       (iter (* result n) (- n 1))))
   (iter 1 n))

Should be compiled to:

let fact_iter n =
  let rec iter result n =
    if n = 1
    then result
    else iter (result * n) (n - 1)
  in (iter 1 n)

The plan is to compile the parsed Parser.node to Compiler.ocaml_expr.

@thanhnguyen2187 thanhnguyen2187 changed the title Make compilation (--compile /tmp/file.scm) works Make compilation (--compile ...) works Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant