Skip to content

Commit

Permalink
* Fix wording in transformators and README.
Browse files Browse the repository at this point in the history
* Remove UNKNOWN-TRANSFORMATION condition. Evaluate keyword as is.
  • Loading branch information
Volkan YAZICI committed Jul 28, 2007
1 parent eaf03d0 commit c6a220b
Show file tree
Hide file tree
Showing 2 changed files with 258 additions and 120 deletions.
53 changes: 33 additions & 20 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ commonly used streams, for efficiently stepping backward and forward
through the input. It is tested on SBCL but should be portable to
other implementations as well.

meta-sexp is implemented using a modular transformation
processers. Therefore, besides builtin grammar transformators coming
with meta-sexp, you can easily add your own transformation rules to
meta-sexp too. (See REGISTER-TRANSFORMATION macro in meta-sexp.lisp.)

Inspired by src/parser.lisp of core-stream project at
http://core.gen.tr/

Expand Down Expand Up @@ -119,49 +124,57 @@ ALNUM? ALPHA? GRAPHIC? ASCII? BIT? DIGIT? EXTENDED? LOWER? NEWLINE?
SPACE? TAB? UPPER? WHITE-SPACE?


,---------------------------.
| AVAILABLE SYNTAX KEYWORDS |
`---------------------------'
,--------------------------.
| BUILT-IN TRANSFORMATIONS |
`--------------------------'

(:ICASE FORM FORM ...)
Process supplied FORMs case-insensitive.
Make case-insensitive atom comparison in supplied FORMs.

(:CHECKPOINT FORM)
If form returns NIL, cursor will be back-positioned to its old
location :CHECKPOINT keyword was used.
Sequentially evaluates supplied forms and if any of them fails,
moves cursor back to its start position :CHECKPOINT began.

(:AND FORM FORM ...)
(:OR FORM FORM ...)

(:NOT FORM)
Besides its normal behaviour, (:NOT ...) expressions
automatically get encapsulated in (:CHECKPOINT ...) clauses.
Identical to (NOT FORM). (FORM is encapsulated within a :CHECKPOINT
before getting evaluated.)

(:RETURN VAR VAR ...)
Returns supplied variables using VALUES function.
(:RETURN VALUE VALUE ...)
Returns from the rule with supplied VALUEs.

(:RENDER RENDERER ARG ARG ...)
Calls specified RENDERER (that is defined with DEFRENDERER) with
supplied arguments.

(:OPTIONAL FORM FORM ...)
(:? FORM FORM ...)
May appear once. (Similar to `?' in regular expressions.)
Sequentially evaluates supplied FORMs within an AND scope and
regardless of the return value of ANDed FORMs, block returns T.
(Similar to `?' in regular expressions.)

(:SOME FORM FORM ...)
(:* FORM FORM ...)
May appear none or more. (Similar to `*' in regular expressions.)

(:MANY FORM FORM ...)
Sequentially evaluates supplied FORMs within an AND scope until it
returns NIL. Regardless of the return value of ANDed FORMs, block
returns T. (Similar to `*' in regular expressions.)

(:+ FORM FORM ...)
Must appear at least once. (Similar to `{1,}' in regular expressions.)
Sequentially evaluates supplied FORMs within an AND scope, and
repeats this process till FORMs return NIL. Scope returns T if FORMs
returned T once or more, otherwise returns NIL. (Similar to `{1,}'
in regular expressions.)

(:TYPE TYPE-CHECKER)
(:TYPE (OR TYPE-CHECKER TYPE-CHECKER ...))
Checks type of the atom at the current position through supplied
function(s).

(:RULE RULE)
(:RULE (OR RULE RULE ...))
Tests current input from the current cursor position using
specified type/form.
Tests input in the current cursor position using specified
type/form. If any, supplied arguments will get passed to rule.

(:ASSIGN VAR FORM)
(:ASSIGN (VAR1 VAR2 ...) FORM)
Expand All @@ -186,7 +199,7 @@ SPACE? TAB? UPPER? WHITE-SPACE?
Returns true when reached to the end of supplied input data.

(:READ-ATOM)
Reads current atom at the cursor position.
Reads current atom at the cursor position and returns read atom.

(:DEBUG)
(:DEBUG VAR)
Expand All @@ -199,7 +212,7 @@ three possiblities remaining:
i. This can be a character.
ii. This can be a string. (Will get expanded into an AND'ed character
list with an outermost :CHECKPOINT.)
iii. Treat as a custom form. (Will get evaluated as is.)
iii. Treat as a custom form. (Will get evaluated as is)

When you're in the third situation, to be able to get your META
s-expressions compiled again, use META keyword. (See the second
Expand Down
Loading

0 comments on commit c6a220b

Please sign in to comment.