yacal

module
v0.0.0-...-b99ef92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2022 License: GPL-3.0

README

yacal

Yet Another Compiler Adjustment of Lisp - interpreter for toy functional language written within Compiler Construction (S22) course in IU.

How to run

Naive

On Linux/MacOs download appropriate interpreter and simply run it from console

./yacal <files>

On Windows the same

./yacal.exe <files>

If no files specified the interpreter will run in interactive mode.

Sources compilation

Alternatively, you can compile the sources for your machine.

go build https://github.com/gragov4ik/yacal/cmd/yacal

or

go build cmd/yacal

Language description

Yacal is a simple toy functional language.

Currently, there are implemented a small subset of very crucial built-in functions and constructs, such as functions/lambdas, simple arithmetic operations, predicates, logic, list constructors/destructors and some other.

It follows the syntax rules of the Lisp programming language.

Many examples you can find in examples folder.

For instance, dot_product.yacal

(print "Enter n:")
(set n (toint (input)))

(func enter_n (n) (
    cond (> n 0)
    (cons (toint (input)) (enter_n (- n 1)))
    '()
))

(print "Enter v1:")
(set v1 (enter_n n))
(print)
(print "Enter v2:")
(set v2 (enter_n n))
(print)

(func dot (v1 v2) (
    cond (isempty v1)
    '()
    (cons (* (head v1) (head v2)) (dot (tail v1) (tail v2)))
))

(print (dot v1 v2))

Authors

Ivan Rybin, Kirill Ivanov, Lev Lymarenko, Ilya Kolomin

License

GNU General Public License v3.0, see LICENSE

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL