Profile cover photo
Profile photo
Jeffrey Kegler
81 followers
81 followers
About
Jeffrey Kegler's posts

Post has shared content
My spare time being limited, I found only enough from it to write a binary structure parser using #Marpa , the Java Class file binary format.
This will become a MarpaX::Java::ClassFile::AST or something similar soon.
An interesting exercise indeed.

Works great, as usual with #Marpa  -;

Post has shared content
This is the information age. Knowledge is free and infinite, but it seems stupidity is both cheaper and more abundant.

Post has shared content

Post has shared content
Ok, now I can blog on MarpaX::Languages::M4, finally - better late than never...
re::engine::GNU caused me a lot of troubles when I came to utf-8 (Perl's UTF-8, NOT Unicode as per the standard), and I ended up writing XS equivalents to C wide-char API (I mean: mbrtowc, and so on).

Post has shared content
A Marpa visualization would be really nice.
The best thing i've read on the subject, especially in the way how the animations don't kick off until you advance to them.

Post has attachment
In its power to parse in linear time, Marpa claims to be a big advance over traditional parsers.  But there have been a lot of excessive claims for parsers in the past so, not unreasonably, there is skepticism out there.  My new blog post addresses it.

Post has attachment

Post has attachment
Would the ranking have considered it a "fact" that parsing was a solved problem, with LALR/yacc as the solution, and top-down the only reasonable alternate solution?  Certainly a few years ago everybody considered these to be facts.

Post has shared content

Post has shared content
I have released MarpaX-Languages-M4-0.001-TRIAL.tar.gz on CPAN.

This release includes an experimental command-line whose name is: m4pp (i.e. M4 in Pure Perl).

Almost everything is in it except:
* Support of _file_ and _line_ GNU extensions
* The m4pp binary does not switch to interactive mode automatically, you have to use the -i option

Otherwise I invite readers to read the m4pp --help to see how my M4 differs from POSIX and/or GNU. There are a lot more options! And I am probably the first one that explicitly give the possibility to change default quote-markups at the command-line level, plus other things -;

USAGE: m4pp [-BDdEGghIioPQtUvW] [long options...]

    --builtin_need_param: [Strings]
        Recognized-only-with-parameters policy. Repeatable option. Multiple
        values can be given in the same switch if separated by the comma
        character ','. Says if a macro is recognized only if it is
        immediately followed by a left parenthesis. Every option value is
        subject to the value of word_regexp: if it matches word_regexp at
        the beginning, then the option is considered. Any attempt to set it
        on the command-line will completely overwrite the default. Default:
        define,undefine,defn,pushdef,popdef,indir,builtin,ifdef,ifelse,shift,changeword,m4wrap,include,sinclude,len,index,regexp,substr,translit,patsubst,format,incr,decr,eval,syscmd,esyscmd,mkstemp,maketemp,errprint.

    
    --cmdtounix:
        Convert any command output from platform's native end-of-line character
        set to Unix style (LF). Default to a false value.

    
    --comment_end: String
        Comment end. An empty option value is ignored. Default value: the
        newline character.

    
    --comment_start: String
        Comment start. An empty option value is ignored. Default: "#".

    
    -o --debugfile: String
        Debug file. An empty value disable debug output. A null value redirects
        to standard error. Default is a null value.

    
    -d --debugmode: String
        Debug mode. This is a combinaison of flags, that can be: "a", "c", "e",
        "f", "i", "l", "p", "q", "t", "x", or "V" wich will put everything
        on. Default: "aeq".

    
    -D --define: [Strings]
        Macro definition. Repeatable option. Every option value is subject to
        the value of word_regexp: if it matches word_regexp at the
        beginning, then a macro is declared. For example: --define myMacro.
        Or --word_regexp x= --define x=. Default expansion is void, unless
        the matched name is followed by '=', then any remaining character
        will be the expansion of this new macro. For example: --define
        myMacro=myExpansion. Or --word_regexp x= --define x==myExpansion.
        Default is empty.

    
    --divert_type: String
        Divertion type. Possible values: "memory" (all diversions are kept in
        memory), "temp" (all diversions are kept in temporary files).
        Default: "memory".

    
    --fatal_warnings:
        If unspecified, have no effect. If specified once, impl_rc() will return
        EXIT_FAILURE. If specified more than once, any warning is fatal.
        Default: a false value.

    
    -g --gnu:
        Enable all extensions.

    
    -I --include: [Strings]
        Include directory. Repeatable option. Will be used in order and after
        current directory when searching for a file to include. Default is
        empty.

    
    --inctounix:
        Convert any included file from platform's native end-of-line character
        set to Unix style (LF). Default to a false value.

    
    --integer_bits: Int
        Number of bits for integer arithmetic. Possible values: any positive
        integer. Default is "unsigned int" C-type number of bits from the
        libc used to build this version of perl. Meaningul only when
        policy_integer_type is "bitvector". Default: 32.

    
    --integer_type: String
        Integer type. Possible values: "native" (will use what your hardware
        provides), "bitvector" (will use s/w-driven bit-per-bit
        manipulations; this is the only portable option value). Default:
        "bitvector".

    
    -i --interactive:
        Read STDIN and parse it line by line, until EOF.

    
    --m4wrap_order: String
        M4wrap unbuffer mode. Possible values: "LIFO" (Last In, First Out),
        "FIFO" (First In, First Out). Default: "LIFO".

    
    --param_can_be_macro: [Strings]
        Can-a-macro-parameter-be-an-internal-macro-token policy. Repeatable
        option. Multiple values can be given in the same switch if separated
        by the comma character ','. Says if a macro parameter can be an
        internal token, i.e. a reference to another macro. Every option
        value is subject to the value of word_regexp: if it matches
        word_regexp at the beginning, then the option is considered. On the
        command-line, the format has to be: word-regexp=?
        numbersOrStarSeparatedByColon?. For example: --
        policy_paramcanbemacro popdef,ifelse=,define=1,xxx=3:4,yyy=* says
        that popdef and ifelse do not accept any parameter as macro, but
        parameter at indice 1 of the define macro can be such internal
        token, as well as indices 3 and 4 of xxx macro, and any indices of
        macro yyy. Any attempt to set it on the command-line will completely
        overwrite the default. Default:
        define=0:1,pushdef=1,indir=,builtin=.

    
    -P --prefix_builtins:
        Prefix of all builtin macros with 'm4_'. Default: a false value.

    
    -B --prepend_include: [Strings]
        Include directory. Repeatable option. Will be used in reverse order and
        before current directory when searching for a file to include.
        Default is empty.

    
    --quote_end: String
        Quote end. An empty option value is ignored. Default: "'".

    
    --quote_start: String
        Quote start. An empty option value is ignored. Default: "`".

    
    -Q --silent:
        Silent mode. If true all warnings will disappear. Default: a false
        value.

    
    --tokens_priority: [Strings]
        Tokens priority. If setted, it is highly recommended to list all allowed
        values, that are : "WORD", "MACRO", "QUOTEDSTRING", and "COMMENT".
        The order of appearance on the command-line will be the prefered
        order when parsing M4 input. Multiple values can be given in the
        same switch if separated by the comma character ','. Unlisted values
        will keep their relative order from the default, which is: 4. Please
        note that when doing arguments collection, the parser forces
        unquoted parenthesis and comma to have higher priority to quoted
        strings and comments.

    
    -t --trace: [Strings]
        Trace mode. Repeatable option. Multiple values can be given in the same
        switch if separated by the comma character ','. Every option value
        will set trace on the macro sharing this name. Default is empty.

    
    -G --traditional:
        Suppress all extensions.

    
    -U --undefine: [Strings]
        Macro undefinition. Repeatable option. Every option value is subject to
        the value of word_regexp: if it matches word_regexp at the
        beginning, then a macro is deleted if it exists. Default is empty.

    
    -v --version:
        Print the version number of the program on standard output, then
        immediately exit.

    
    --warn_macro_sequence: String
        Issue a warning if a macro defined via builtins define or pushdef is
        matching this regexp. An empty string disables the check. Default:
        "\$(?:\{[^\}]*\}|[0-9][0-9]+)".

    
    -W --word_regexp: String
        Word perl regular expression. Default: "[_a-zA-Z][_a-zA-Z0-9]*".

    
    --usage:
        show a short help message

    
    -h --help:
        show a help message

    
    --man:
        show the manual
Wait while more posts are being loaded