Skip to content

yashi/lex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

C version of Lexical Scanning in Go by Rob Pike

Note

This is a quick implementation of a lexer presented by Rob Pike in C.

To match the original Go version, variables and function names are kept as in Go’s, no memory boundary test isn’t done to reduce code diff; Especially, C does not have String nor Slice.

Because C does not have Channel, emitter is just a wrapper for printf(). It might be better to give a call back function to the lexer from caller.

Also, C does not have ability to define methods on type, all lexer methods are defined with prefix `lexer_’.

C is not capable to define a function returning a pointer to a function with the same signature. To overcome this limitation, void pointer is used as the return type. C seems to allow function pointer -> void pointer -> function pointer round trip.

Reference

About

C version of Lexical Scanning in Go by Rob Pike

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published