Questions tagged [ometa]

OMeta is an object oriented language for pattern matching, which tries to provide convenient way for programmers to create parsers and compilers.

Its highlights include:

  • Rules apply to a stream of objects, not just a stream of characters
  • Extend a parser that already exists
  • Call rules from other parsers (foreign rule mechanism)
  • Higher order rules (rules that take other rules as arguments)
  • Support for left recursive rules
7 questions
21
votes
2 answers

What makes Ometa special?

Ometa is "a new object-oriented language for pattern matching." I've encountered pattern matching in languages like Oz tools to parse grammars like Lexx/Yacc or Pyparsing before. Despite looking at example code, reading discussions, and talking to…
Brian
  • 25,523
  • 18
  • 82
  • 173
7
votes
1 answer

BNF grammar definition for file path wildcard (glob)

I'm searching for some widely extended dialect (like this one https://github.com/vmeurisse/wildmatch + globstar **) described with BFN rules. In any format or language. OMeta or PEG would be great.
Ev_genus
  • 135
  • 11
6
votes
0 answers

OMeta underscore and dots

Hello I need to modify the following OMeta PEG : using OMetaSharp; using System.Collections; using System.Text; ometa SExpression.GeneratedCode.SExpressionParser : Parser { SExpression = Spaces Atom:a Spaces -> { a } | Spaces…
weirdgyn
  • 886
  • 16
  • 47
3
votes
1 answer

How do I match a word with OMetaJS?

I've been trying to learn OMeta using OMeta/JS and I seem to be getting stuck on something that should be really straightforward. If I have a grammar ometa L <: Parser { l letter:l -> l } L.match('h', 'l') It produces the expected output h I can…
bmavity
  • 2,477
  • 2
  • 24
  • 23
2
votes
1 answer

How to use ometa-js

Anyone can explain how to get for instance the sample running? I downloaded the ometa-js rep from github and opened index.htm, which results in an error. The hosted version at http://www.tinlizzie.org/ometa-js displays errors inside the sourcecode…
citykid
  • 9,916
  • 10
  • 55
  • 91
1
vote
2 answers

Creating AST with OMetaJS that includes token value and position

I'm trying to parse a DSL with OMetaJS and produce an AST that includes a token value as well as it's index in the original stream. I know I can use the Index Capture Rule syntax ( @ ) to give me an object containing the indices framing the…
emertechie
  • 3,607
  • 2
  • 22
  • 22
0
votes
1 answer

How can I access the entire matched string in Python Parsley?

I'm using OMeta and Python Parsley (http://parsley.readthedocs.org/) for parsing. Is there a way to access the string matched by a specific rule? For example, consider this code: In [1]: import parsley In [2]: g = parsley.makeGrammar('addr =…
Reece
  • 7,616
  • 4
  • 30
  • 46