You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

lnac

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lnac

A toy functional language compiler written in Python

0.0.9
pipPyPI
Maintainers
1

LnaC

A toy functional language compiler written in Python.

LnaC is a toy functional language compiler written in Python 3 that supports limited program generation.

For some sample programs, see the demos directory.

Quickstart

To install LnaC:

pip3 install lnac

To create, compile, and run an example program:

$ nano return0.lna
$ less return0.lna

main : int
main =
    => 0

$ lnac return0.lna
$ ./return0 && $?
True

Implementation

Lexer

The LnaC lexer is primarily implemented in lexer.py. Additionally, tokens.py contains definitions of the token classes used in the lexer and instances of recognized keyword and symbol tokens.

Parser

The LnaC parser is implemented in parser/parser.py and creates an abstract syntax tree of nodes defined in tree/nodes.py.

Assembly

LnaC writes out an intermediary assembly file that gcc then generates an executable from. This assembly file is written following the AT&T assembly syntax and is deleted following a successful compilation.

References

Keywords

lnac lna compiler functional programming parsing lexing

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts