How verse-lang/verse works
Project type and purpose
• This is a compiler project (“The Verse Programming Language”) split into several sub-areas:
• A C++-based compiler implementation (in cpp-compiler/)
• Verse standard library modules (in std/)
• Example Verse programs (in examples/)
• An editor integration/grammar definition (in language-verse/)
• Purpose: take .vrs source code, lex/parse it, perform semantic analysis, emit LLVM IR, run it through LLVM optimizer, and produce a native executable.
File structure
• Top-level directories:
• cpp-compiler/: all compiler source (.hpp, main.cpp, lex.hpp, parse.hpp, test.cpp)
• std/: prewritten Verse standard modules (.vrs files)
• examples/: sample Verse programs
• language-verse/: grammar (verse.cson), editor settings, styles, package.json
• The compiler directory clearly follows a traditional compiler pipeline: lexing (Token.hpp, lex.hpp), parsing (Expression.hpp, parse.hpp), symbol management (Scope.hpp, NamedValue.hpp, IDGenerator.hpp), intermediate structure (StringTree.hpp, Match.hpp), and I/O (File.hpp, Stream.hpp).
• No build scripts at top level; README instructs manual g++ compile inside cpp-compiler/.
README for additional insights
• Confirms design: compile to LLVM IR and run optimizer for best performance.
• States current stage: pre-alpha, self-hosting is a future milestone.
• Build step is simply “g++ main.cpp” inside cpp-compiler/.
Elements
• From “Examples & User Code” and “std/ modules” into “Lexer”.
• From “Lexer” to “Parser”, then to “Semantic Analyzer”, then to “Code Generator”, then to “LLVM Optimizer/Backend”, then to “Executable Output”.
• Another for I/O/loader components (e.g., green) like std loader and examples.