使用Sphinx翻译LLVM的中文文档

Sphinx是一款非常方便的文档生成工具,以前就早有耳闻,最近计划将LLVM的文档翻译一些,在打开LLVM的文档源文件后发现,整个文档部分整理的非常整洁。下载的最新版LLVM-3.8版的源码,已经完全使用Sphinx生成文档,于是我也学习了一些Sphinx的相关用法。

Sphinx是python编写的一款命令行工具,在python3或python2下都能正常的工作,安装可以使用流行的pip进行安装:

$ pip install sphinx --upgrade
$ pip install sphinx-intl

Sphinx的依赖项比较新,最好还是更新一下比较好。sphinx-intl是一个命令行工具,用来实现多语言翻译的。

Sphinx有着非常独特且方便的代码翻译模型,可以用工具将英语版编写的文档中的文字全部抽取出来,在.po文件下,可以让用户方便地进行修改和翻译。最后根据生成时的语言配置,构建对应语言版本的文档。

sphinx i18n model

不过我们先不管Sphinx是如何进行翻译抽取的,先来看下LLVM文档的构建。

基本HTML文档的构建

默认LLVM的docs目录下的makefile是给doxygen使用的,这里我将Makefile.sp

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Become familiar with the LLVM infrastructure and start using LLVM libraries to design a compiler About This Book Learn to use the LLVM libraries to emit intermediate representation (IR) from high-level language Build your own optimization pass for better code generation Understand AST generation and use it in a meaningful way Who This Book Is For This book is intended for those who already know some of the concepts of compilers and want to quickly get familiar with the LLVM infrastructure and the rich set of libraries that it provides. What You Will Learn Get an introduction to LLVM modular design and LLVM tools Convert frontend code to LLVM IR Implement advanced LLVM IR paradigms Understand the LLVM IR Optimization Pass Manager infrastructure and write an optimization pass Absorb LLVM IR transformations Understand the steps involved in converting LLVM IR to Selection DAG Implement a custom target using the LLVM infrastructure Get a grasp of C's frontend clang, an AST dump, and static analysis In Detail LLVM is currently the point of interest for many firms, and has a very active open source community. It provides us with a compiler infrastructure that can be used to write a compiler for a language. It provides us with a set of reusable libraries that can be used to optimize code, and a target-independent code generator to generate code for different backends. It also provides us with a lot of other utility tools that can be easily integrated into compiler projects. This book details how you can use the LLVM compiler infrastructure libraries effectively, and will enable you to design your own custom compiler with LLVM in a snap. We start with the basics, where you'll get to know all about LLVM. We then cover how you can use LLVM library calls to emit intermediate representation (IR) of simple and complex high-level language paradigms. Moving on, we show you how to implement optimizations at different levels, write an optimization pass, generate code that is independent of a target, and then map the code generated to a backend. The book also walks you through CLANG, IR to IR transformations, advanced IR block transformations, and target machines. By the end of this book, you'll be able to easily utilize the LLVM libraries in your own projects. Style and approach This book deals with topics sequentially, increasing the difficulty level in a step-by-step approach. Each topic is explained with a detailed example, and screenshots are included to help you understand the examples. Table of Contents Chapter 1. Playing with LLVM Chapter 2. Building LLVM IR Chapter 3. Advanced LLVM IR Chapter 4. Basic IR Transformations Chapter 5. Advanced IR Block Transformations Chapter 6. IR to Selection DAG phase Chapter 7. Generating Code for Target Architecture

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值