Lightweight Eiffel source code parser for extracting structural information. Designed for IDE tooling, code analysis, and documentation generation.
Part of the Simple Eiffel ecosystem.
Developed using AI-assisted methodology: Built interactively with Claude Opus 4.5 following rigorous Design by Contract principles.
simple_eiffel_parser is a recursive descent parser that extracts structural information from Eiffel source code without performing full semantic analysis. It is optimized for speed and IDE use cases rather than compilation.
What it extracts:
- Class declarations (deferred, expanded, frozen)
- Feature signatures with types
- Arguments and local variables
- Preconditions and postconditions
- Inheritance relationships (rename, redefine, undefine, select)
- Header comments for documentation
What it does not do:
- Type checking or inference
- Semantic analysis
- Full expression parsing
- SCOOP semantics validation
local
parser: SIMPLE_EIFFEL_PARSER
ast: EIFFEL_AST
do
create parser.make
ast := parser.parse_file ("my_class.e")
across ast.classes as c loop
print ("Class: " + c.name + "%N")
across c.features as f loop
print (" Feature: " + f.name + "%N")
end
end
end- simple_eiffel_parser.e - Facade class (107 lines)
- eiffel_parser.e - Recursive descent parser (871 lines)
- eiffel_lexer.e - Tokenizer (436 lines)
- eiffel_token.e - Token definitions (160 lines)
- Plus AST node classes for classes, features, arguments, locals, parents, errors
Total: 2,327 lines of Eiffel code across 11 classes.
- simple_file - File reading
- simple_regex - Pattern matching
export SIMPLE_EIFFEL_PARSER=/path/to/simple_eiffel_parser
export SIMPLE_FILE=/path/to/simple_file
export SIMPLE_REGEX=/path/to/simple_regex
ec.exe -batch -config simple_eiffel_parser.ecf -target simple_eiffel_parser_tests -c_compile
./EIFGENs/simple_eiffel_parser_tests/W_code/simple_eiffel_parser.exeThe primary consumer is simple_lsp, the Eiffel LSP server. The parser provides symbol information for go-to-definition, hover documentation, code completion, and document outline.
| Feature | Status |
|---|---|
| Basic parsing | Complete |
| Contract extraction | Complete |
| Error recovery | Complete |
| Comment preservation | Complete |
| Generic parsing | Complete |
| ECF parsing | Planned |
| Type resolution | Planned |
MIT License
