C/C++ Convert Manual Text to HTML format?

hruodr

Well-Known Member

Reaction score: 39
Messages: 276

I am a bit suprised that you are against superfluous methods. Usually, high-level programming language is THE solution. As seen above.
I was arguing that lex and yacc are necessary and hence not superfluous.

Yes, try lex, it is very useful alone and can do a lot for your purpose, perhaps with a little programming. It is easier to learn than yacc, but you may need it also. They are in every unix installation, I have yacc trice in my computer: the one of (Free)BSD, the one of Plan9 (original) and (gnu)bison.
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Reaction score: 142
Messages: 806

I was arguing that lex and yacc are necessary and hence not superfluous.

Yes, try lex, it is very useful alone and can do a lot for your purpose, perhaps with a little programming. It is easier to learn than yacc, but you may need it also. They are in every unix installation, I have yacc trice in my computer: the one of (Free)BSD, the one of Plan9 (original) and (gnu)bison.
I should try likely,

Can Lex do filecopy and more file handling?
 

hruodr

Well-Known Member

Reaction score: 39
Messages: 276

What do you mean with filecopy? You can embed your own C code and program in the lex input, and that can do anything. lex generates C code for a function int yylex() that when called reads until the next token, return the token number and can set external variables, for example yyval containing what it read or something related to what it read. When called it again, does the same with the next token, and so on. Then you can use this function in your own C functions. The return value (token) and the external variables (eg. yyval) are defined by you with the input to lex, and also what is a token: yylex() can also not return untill it read all the text, but do some output when reading it. Just read carefuly man lex().
 

hruodr

Well-Known Member

Reaction score: 39
Messages: 276

For basic approach in C, it is just 20-30 lines about
I have no doubt that it is possible. I told you that I use among others Tcl for text processing, that it is by far my favourite scripting language. This is what Brian W. Kernighan writes about Tcl:

The split into two components was encouraged and ultimately forced by two issues. First, Tcl's notation for
arithmetic expressions is clumsy; it is easier to write most expressions in C. More important, however, Tcl is not very
good at data structures, since it provides only associative arrays and strings (upon which a veneer of linked lists can
be applied). Again, C or C++ is more expressive and the code is much easier to maintain. These operations also run
significantly faster in C/C++; this more than compensates for any extra file traffic.
(BTW: Tcl offers today more than associative arrays and strings)

If you believe him, C is better. Of course you can also use libraries in C for the build in features of Tcl you may miss in C. Most of the negative view of C for this purposes may come from laziness to programming in C, but not only.

To see how good tcl is, just see more quotes like the above one:

https://wiki.tcl-lang.org/page/Who+says+Tcl+sucks...

(... belongs is part of URL, but forums.freebsd.org do not accept them as such)
 
OP
OP
Spartrekus

Spartrekus

Aspiring Daemon

Reaction score: 142
Messages: 806

I have no doubt that it is possible. I told you that I use among others Tcl for text processing, that it is by far my favourite scripting language. This is what Brian W. Kernighan writes about Tcl:



(BTW: Tcl offers today more than associative arrays and strings)

If you believe him, C is better. Of course you can also use libraries in C for the build in features of Tcl you may miss in C. Most of the negative view of C for this purposes may come from laziness to programming in C, but not only.

To see how good tcl is, just see more quotes like the above one:

https://wiki.tcl-lang.org/page/Who+says+Tcl+sucks...

(... belongs is part of URL, but forums.freebsd.org do not accept them as such)
Likely, maybe, indeed it might come more from programmer laziness...
 
Top