How xxrjun/mini-lisp-interpreter works
Main Components
• Lexical Analyzer: Represent the component that is built from the Lex source (src/minilisp.l). Indicate that this module tokenizes the input LISP code.
• Syntax Analyzer / Parser: Show that the Yacc/Bison file (src/minilisp.y) defines the grammar rules which, together with the lexical analyzer, build the parse tree / semantic structure of the program.
• Build/Compilation Process:
• Build process steps described in the README (using bison and lex/ flex, then compiling with gcc).
• That the output from these processes lands in the bin directory (e.g., bin/minilisp or bin/minilisp.exe).
• Testing Suite: Outline the tests folder which includes public test cases (LISP source files and an answer file) and the test scripts (run_tests.sh) that compile, execute, and verify the output.
• Documentation and Assets: Although not central to the execution pipeline, include the docs and assets directories to indicate supplementary design documents and visual aids (like the PDF specifications).
And Represent the Relationships and Interactions
• Data flow should begin with the input LISP programs (files in tests/public_test_data or the example folder) going into the lexical analysis phase.
• Once tokens are processed by Lex, these are passed to the parser (Yacc/Bison) to validate the syntax and build the underlying representation (such as an AST or parse stack).
• Build scripts and Makefile should be included as orchestration elements that integrate all these processes.
Architectural Patterns and Key Technologies
• Common compiler construction pattern: Input → Lexical Analysis → Parsing → Evaluation/Execution.
• Use annotations to indicate that the parsing phase is responsible for handling LISP-specific syntax (as specified in the Mini-LISP language documents).