metalanguage: a language for describing other languages

  • 19 Replies
  • 10273 Views
*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: metalanguage: a language for describing other languages
« Reply #15 on: February 13, 2016, 06:50:04 pm »
... Returning to differ <= and <- operators: less mess for thinking when using it. Also returning to defining new symbols without prefix and existing symbols with "@" prefix: looks more clean and readable.

I had an itch when using Regexp with javascript parsing, there's no way to efficiently check does an regexp match the value at specific offset in a string. Splicing string on every check was not my option, so I decided to program my own Regexp library. I followed some documentation and got this implementation:

Code
RegExp <= (
    Union <= (@SimpleRE, '|', @RegExp) |
    SimpleRE <= (
        Concatenation <= (@BasicRE, @SimpleRE) |
        BasicRE <= (
            OneOrMore <= (@ElementaryRE, ('+?' | '+')) |
            ZeroOrMore <= (@ElementaryRE, ('*?' | '*')) |
            ZeroOrOne <= (@ElementaryRE, '?') |
            NumberedTimes <= (
                '{',
                In <= (
                    Exactly <= @Integer |
                    AtLeast <= (@Integer, ',') |
                    AtLeastNotMore <= (@Integer ',', Integer)
                ),
                ('}?' | '}')
            ) |
            ElementaryRE <= (
                Group <= ('(', @RegExp, ')' |
                Any <= '.' |
                Eos <= '$' |
                Bos <= '^' |
                Char <= (
                    @NonMetaCharacter |
                    '\\', (
                        @MetaCharacter |
                        't' | 'n' | 'r' | 'f' | 'd' | 'D' | 's' | 'S' | 'w' | 'W' |
                        @Digit, @Digit, @Digit
                    )
                ) |
                Set <= (
                    PositiveSet <= ('[', @SetItems, ']') |
                    NegativeSet <= ('[^', @SetItems, ']')
                ) <~ (
                    SetItems <= (
                        SetItem <= (
                            Range <= (@Char, '-', @Char) |
                            @Char
                        ) |
                        @SetItem, @SetItems
                    )
                )
            )
        )
    )
)

It would work with some javascript back-end, but when I compared "union" to "set" in Regexp definition, I concluded they are about the same thing, a choice of values detected at parse time. Didn't like this redundancy, so I decided to slightly change the definition of Regexp and to develop my own version of it which looks like this:

Code
    ChExp <= (
        Choice <= (@ConExp, '|', @ChExp) |
        ConExp <= (
            Concatenation <= (@WExp, @ConExp) |
            WExp <= (
                Without <= (QExp, '!', @WExp) |
                QExp <= (
                    OneOrMore <= (@GExp, '+') |
                    ZeroOrMore <= (@GExp, '*') |
                    ZeroOrOne <= (@GExp, '?') |
                    NumberedTimes <= (@GExp, '{', @Integer, '}') |
                    GExp <= (
                        Group <= ('(', @ChExp, ')') |
                        Exp <= (
                            Any <= '.' |
                            Range <= (@Char, '-', @Char) |
                            Char <= (
                                @NonMetaCharacter |
                                '\\', (
                                    @MetaCharacter |
                                    't' | 'n' | 'r' | 'f' |
                                    '0x', @HEXDigit, @HEXDigit, @HEXDigit, @HEXDigit, @HEXDigit, @HEXDigit
                                )
                            )
                        )
                    )
                )
            )
        )

While implementing extra "without" operator to cover negative set from original Regexp, the new Regexp version is more expressive than original one. For example, the expression "(.*)!((keyword1)|(keyword2))" matches any size string that is different from "keyword1" and "keyword2". In regular Regexp it is possible only to exclude specific character from matching, while I've got exclusion of the whole string. The new definition looks more clean and it does not suffer from choice redundancy.

I have to say, probably structured way of defining grammar in Metafigure saved me  from pitfalls which original authors of Regexp had in the seventies when they probably used unstructured BNF. I'm kind of proud at Metafigure, it got me a better version of Regexp already, and it is not even finished yet.

Otherwise, I already started to program Metafigure in Javascript, and I plan the crippled version 0.2 soon, which should be sufficient to parse English texts (yes, it is the very NLP - among other stuff - I'm working on).

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: metalanguage: a language for describing other languages
« Reply #16 on: April 20, 2016, 07:22:27 pm »
Here is what wiki says about "metatheory":

Quote
A metatheory or meta-theory is a theory whose subject matter is some theory. All fields of research share some meta-theory, regardless whether this is explicit or correct. In a more restricted and specific sense, in mathematics and mathematical logic, metatheory means a mathematical theory about another mathematical theory.

The following is an example of a meta-theoretical statement:

“   Any physical theory is always provisional, in the sense that it is only a hypothesis; you can never prove it. No matter how many times the results of experiments agree with some theory, you can never be sure that the next time the result will not contradict the theory. On the other hand, you can disprove a theory by finding even a single observation that disagrees with the predictions of the theory.   â€

Meta-theoretical investigations are generally part of philosophy of science. Also a metatheory is an object of concern to the area in which the individual theory is conceived.

This is just what I'm after: a general metatheory.

*

keghn

  • Trusty Member
  • *********
  • Terminator
  • *
  • 824
Re: metalanguage: a language for describing other languages
« Reply #17 on: April 20, 2016, 09:40:58 pm »
SGML HTML XML What's the Difference? (Part 1) - Computerphile:


*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: metalanguage: a language for describing other languages
« Reply #18 on: April 20, 2016, 10:44:10 pm »
Though with strict syntax, XML would be a language by which a lot of other languages (if not all) can be expressed. There is even a programming language named "Fabula" whose programs are entirely expressed by XML (but you have to use predefined tags like <string>, <class>, <applet>...)

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: metalanguage: a language for describing other languages
« Reply #19 on: April 21, 2016, 06:50:27 pm »
Decided to change "<-" operator to "=>", in order to match my new insights from some logic investigation.

So: A <- B becomes A => B.

Functions are also defined somewhat different, with parameters on the left of "<=" / "=>" and the result on the right of "<=" / "=>".

Changed some pronouncements also. "<=" is now read "induces from" and "=>" is read "deduces to". They are not the same as logic implication, although there is some analogy with them, and can be transformed to equivalent expressions with logic implication.

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

379 Guests, 0 Users

Most Online Today: 597. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles