The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Scheme79asm::Compiler - compile Lisp code to SIMPLE assembly

SYNOPSIS

  use App::Scheme79asm;
  use App::Scheme79asm::Compiler;
  use Data::SExpression qw/cons/;

  my $asm = App::Scheme79asm->new;
  my $compiler = App::Scheme79asm::Compiler->new;
  my $string = '(reverse-list 2 1)';
  my $assembly_sexp = $compiler->compile_string($string);
  $asm->process($assembly_sexp);
  $asm->finish;
  $asm->print_verilog

DESCRIPTION

This module takes Lisp code and compiles it to the format that App::Scheme79asm wants it to be.

The two main methods are compile_sexp($sexp) which compiles an already-parsed sexp to assembly format, and compile_string($string) which compiles a string to assembly format.

The assembly format is a sexp. These functions return an already-parsed sexp (an arrayref like the ones returned by Data::SExpression's read method). This arrayref can be passed directly to App::Scheme79asm's process method.

If a string representation of the sexp is required, it can be obtained by calling the dump_sexp function in Data::Dump::Sexp with such an arrayref.

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2018 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.3 or, at your option, any later version of Perl 5 you may have available.