ULC2CLASS(1)

NAME
ulc2class - ulc2class

SYNOPSIS
ulc2class [OPTIONS] <ulc-file.ulc|uld-file.uld>

DESCRIPTION

    ulc2class generates the source files for lexical analysis from ulc file.

    ulc2class <ulc-filepath|lang-name> ulc2class -l {c|cpp|cppcli|cs|java} <ulc-file> ulc2class -lc -e <enum-name> <ulc-file> ulc2class -f <out-filename> -n <class-name> <ulc-file> ulc2class -d <out-dirpath> -f <out-filename> <ulc-file> ulc2class -q [lang-name] ulc2class -q -s <lang-name> ulc2class --dump=<category> <ulc-filepath>,

    where category = [keyw|names|rsvd|hash|ch_ctx|quote|1char|2char|utf]

-o, --output <filepath>
    specify the output file path.

-f, --filename <filename>
    specify the output file name without suffix.

-d, --dirpath <dirpath>
    specify the directory for output files.

-l, --lang=<lang-name>
    specify the target language name.

-n, --class-name=<name>
    specify the name of the class(or enum-name).

-q, --query [lang-name]
    query the list of ulc names.

-s, --uld-sample
    generates a sample uld-file.

-v, --verbose
    verbose mode.

-V, --version
    prints the version information.

-h, --help
    displays the brief help.

The tokens generated by <null> consists of reserved and regular ones. The regular tokens are defined by user. The reserved tokens are the basic tokens that the system initially defines.

  The below are the reserved tokens:

    * EOI(End of Input): The last token of all input streams.

    It returns EOI if the internal input stack is empty!

    * EOF: The internal input structure contains a stack of input streams.

    It returns EOF whenever top of the stacks is consumed.

    * ERR: It returns this err token in case of error. * ID: Identifer token, which should be defined by user in ulc-file. * NUMBER: It represents the current token is number whichever it is integer or floating number. * LINENUM: This informs users of the location of the input cursor. * TMPL: This allows the template variables in uls-file, which must be replaced with strings. * NONE: It returns NONE when the input stack is intial state.

You can specify the qualified long class name with -n-option. For instance, the class name may be 'AAA.BBB.SampleLex', or just class name 'SampleLex'.

To generate c++ headers,

    ulc2class sample.ulc ulc2class -lcpp -n AAA.BBB.SampleLex sample.ulc

The default output of ulc2class is a c++ header file.

To generate header files of other languages, use -l-option.

    ulc2class -lc sample.ulc ulc2class -ljava -n sample sample.ulc

To generate C# wrapper class files,

    ulc2class -lcs -n AAA.BBB.SampleLex sample.ulc ulc2class -d /topdir/AAA/BBB -f SampleLex -lcs -n AAA.BBB.SampleLex sample.ulc The above line specifies the output directory with -d-option. The f-option is used for the common filename of output files.

To generate java class files,

    ulc2class -ljava -n AAA.BBB.SampleLex sample.ulc ulc2class -d /topdir/AAA/BBB -f SampleLex -l java -n AAA.BBB.SampleLex sample.ulc

To query the available names for ulc in the uls repository,

    ulc2class -q

    ..... cpp c++ C++ c_sharp C# c# cs csharp c-sharp go Go golang visual_basic visual-basic VisualBasic 'visual basic' 'Visual basic' .....

    Each line represents the supported names of a language. You may select the any name in same group for your preference. The name must be used as the argument of uls-object creator,

    such as uls_create(), subclasses of UlsLex(), for configuration name.

If you want to know whether or not a language is supported by ULS,

    ulc2class -q golang ulc2class -q c++

To dump the mapping of token name to token number, use -s-option with -q-option.

    ulc2class -q -s golang

    #@golang

    ...... NUMBER -3

    ID -2

    EOF -1 EOI 0

    RUNE_LITSTR 128

    INTERP_LITSTR 129

    RAW_LITSTR 130

    .....

You can modify the token name and number after saving the above output as uld-file

    and specify the path of uld-file in the argument of uls-object creator for configuration name.

Refer to the examples in 'ulc_exam' in the package to see how to write ulc-file. Refer to the examples' or 'tests' to see how to use ulc-file.

    is provided under The MIT License (MIT).

SEE ALSO
The full documentation for ulc2class is maintained as a Texinfo manual. If the info and ulc2class programs are properly installed at your site, the command

    info ulc2class

should give you access to the complete manual.