How delihiros/futhon works
Based on an analysis of the file tree and README, Futhon is a programming language geared toward Natural Language Processing and Machine Learning. Its design uses a classical interpreter architecture with a few clear components:
Project Overview
• Futhon is not a full-stack application but an interpreter/compiler for a domain-specific language.
• It includes a lexer/parser (with a grammar file “futhon.g” and a dedicated “futhon_parser.py”), an evaluator, an environment management layer, and support for language primitives and dynamic operations.
• The provided examples and tests illustrate sample usage and confirm that the interpreter is intended to be used interactively via a REPL, as highlighted by “src/repl.py.”
Key Components
a. Front-End (Parsing and Interpretation):
• futhon.g: The grammar definition for the language.
• futhon_parser.py: The module handling the parsing logic.
• These components work together to translate language source code (written in Futhon syntax) into an abstract representation.
b. Core Interpreter:
• evaluator.py: The core evaluation engine executing the parsed expressions.
• environment.py: Deals with the symbol table and scope handling.
• primitives.py and datatypes.py: Define the language's built-in data types and operations.
• dynamic.py: Likely handles dynamic aspects of the language (such as runtime behavior modifications or dynamic typing).
c. User Interface:
• repl.py: Provides the interactive read-evaluate-print-loop, which accepts user input, processes it through the parser and evaluator, and outputs results.
d. External and Supporting Infrastructure:
• examples directory: Contains sample programs (e.g., chainer_tutorial.fu) showcasing how Futhon can interface with ML libraries like Chainer and NumPy.
• Configuration and Build Files (e.g., setup.py, requirements.txt, .travis.yml): Indicate testing, continuous integration, and dependency management.
• Test folder: Contains unit tests that validate the core interpreter, parser, and evaluation logic.