[Ometa] Beginner Questions

Alessandro Warth alexwarth at gmail.com
Sat Dec 5 14:42:36 PST 2009


Hi Alexandros,

I have been trying to implement an SBVR
<http://www.omg.org/spec/SBVR/1.0/>parserwith OMeta, using the JS 2.0
workspace. Being inexperienced with
> parsers in general, I have hit up against some beginner questions.
>
> 1. what is the way to denote a line break, such that it will parse strings
> of the type:
>
> s =3D 'abcde\
> fghij\
> lmno\
> pqrs'
>

In OMeta/JS, you would just say '\n'. For example, to consume a line of
input, you might write:

line =3D (~'\n' char)* '\n'


... which means "match zero or more characters that are not the newline
character, and then match a newline character.


> 2. which is the complete list of primitives that OMeta JS supports? I know
> digit and char are included, and I could probably figure out a few more, =
but
> where can the complete list be found?
>

The only real "primitive" is a rule called 'anything', and it matches any
one object. All other rules are implemented using a combination of the
anything rule, semantic actions, predicates, and of course, other
non-primitive rules.

A large number of useful rules are pre-defined in a grammar called OMeta,
which is the super-grammar of all the other grammars. These include things
like true, false, number, char, letter, lower, upper, digit, etc.
Unfortunately there is no document that lists and explains all of these
rules at the moment, so I'm afraid you'll have to look at the source code:
http://www.tinlizzie.org/ometa-js/ometa-base.js

(It would be very useful for members of our community to document these
kinds of things as projects on the OMeta/JS Workspace Wiki. You could even
include little examples that the reader can evaluate on the fly, to make it
more interactive... If anyone on this mailing list has written -- or
eventually ends up writing -- this kind of project, please let me know and
I'll add it to the "Important Info" menu.)

Cheers,
Alex


>
> Thans in advance,
> Alexandros Marinos
>
>
> _______________________________________________
> OMeta mailing list
> OMeta at vpri.org
> http://vpri.org/mailman/listinfo/ometa
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://vpri.org/pipermail/ometa/attachments/20091205/a6c3b136/attachme=
nt.htm


More information about the OMeta mailing list