Re: How to express a math expression in a single regular expression?




<sueyic@xxxxxxxxx> wrote in message
news:1133446268.153785.161120@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >So can I described my
>>idea in a regular expression and get a string rather than a tree back?
>
> I don't really understand your math expressions, but you can get a
> string rather than a tree ..
>
> For instance if you have defined
> <SQ_BRACKET_L: "[">
> <SQ_BRACKET_R: "R">
> <NOT_SQ_BRACKET: ~[ "[" , "]" ]>
>
> <SQ_BRACKET_WCONTENTS: <SQ_BRACKET_L> (<NOT_SQ_BRACKET>)*
> <SQ_BRACKET_R>>
>
> If inside your production you did this:
>
> void production() :
> {Token tok;}
> {
> tok = <SQ_BRACKET_WCONTENTS>
> {System.out.println(tok.image);}
> }
>
> Then tok.image should be the string of the bracket w contents instead
> of a tree .. is this what you wanted?

What if part of the expression inside the array index dereferencing
contains another array dereferencing?

I think regular expressions are not powerful enough to capture arbitrary
mathematical expressions.

- Oliver


.



Relevant Pages

  • Re: Get regular expression
    ... own tree structure. ... Expression compares a string character-by character, ... regular expression solution, which was about as close as one could get to ... the structure of the hierarchy can be inferred by using ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to express a math expression in a single regular expression?
    ... >idea in a regular expression and get a string rather than a tree back? ...
    (comp.compilers.tools.javacc)
  • RE: can we use a regular expression to valid a stirng
    ... What do you mean by "composited of tree digital"? ... > Can we use RegularExpression to valid a string in run time? ... > Can I use this regular expression to determinate of a string is composited ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Regular Expression, to use or not to use...
    ... So I have something that will search the string 10x ... Yea thats true, like I said I still use them occasionally, as a hack, ... Also this is an extremly simple re, no |'s or complex expressions. ... >> simple string operations where I can come up with the expression in a ...
    (microsoft.public.dotnet.general)
  • Re: Small confusion about negative lookbehind
    ... > My candidate string is "ab". ... > The expressions I'm testing this string against are the following, ... but the position between characters. ... Regular expressions describe not only strings, ...
    (comp.lang.java.programmer)