|
|
|
|
|
by fexl
5744 days ago
|
|
The whole thing is about 800 lines of C code so far, and I aim to get that lower. :) For one thing, I'm busy bootstrapping the Fexl parser into Fexl itself. It's really neat to be able to express executable concepts simply and completely like this: # Parse a nested parenthesized expression.
\parse_nested =
(
\yes
\no
skip_char ch_lparen
(
parse_expr
(\expr skip_char ch_rparen (yes expr) no)
no
)
no
)
And it's simple to do either-or parsing like this: # Parse a factor: either an id or a nested expression.
\parse_factor =
(
\yes
\no
parse_id (\id yes (var id));
parse_nested yes;
no
)
Even such mundane tasks as skipping white space and comments have a
satisfying elegance about them: # Skip filler, including white space and comments.
\skip_filler =
(
\done
skip_space;
skip_comment
(skip_filler done)
done
)
|
|