doc/README: fix markdown syntax for publication

This commit is contained in:
mappu 2020-06-10 19:10:01 +12:00
parent f7d9556b34
commit f8ae3aac8d

View File

@ -8,52 +8,52 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv
### Phase 1 ### Phase 1
[X] Convert some small programs - [X] Convert some small programs
[X] Error handling - [X] Error handling
- [X] All functions return `(type, error)` - [X] All functions return `(type, error)`
- [X] Convert `throw` to err return - [X] Convert `throw` to err return
- [X] Non-leaf function calls need to check + bubble errors - [X] Non-leaf function calls need to check + bubble errors
[X] Array handling - [X] Array handling
- [X] Infer whether to use slice/map for PHP array - [X] Infer whether to use slice/map for PHP array
[-] Namespaces - [-] Namespaces
- [X] Basic support for `namespace` -> package name transformation - [X] Basic support for `namespace` -> package name transformation
- [ ] Resolve namespace names in calls - [ ] Resolve namespace names in calls
- [ ] Resolve `use` statements - [ ] Resolve `use` statements
[X] `if` - [X] `if`
[X] `for`/`foreach` - [X] `for`/`foreach`
[X] `switch` - [X] `switch`
[ ] Generators - [ ] Generators
[ ] Goto - [ ] Goto
[X] `null` -> `nil` - [X] `null` -> `nil`
[X] Consts and `define()` - [X] Consts and `define()`
- [X] Magic constants (`__LINE__`,`__FILE__` etc) - [X] Magic constants (`__LINE__`,`__FILE__` etc)
- [ ] Predefined constants (`PHP_VERSION`, `PHP_EOL`, `PHP_OS`, `PHP_INT_MAX` etc) - [ ] Predefined constants (`PHP_VERSION`, `PHP_EOL`, `PHP_OS`, `PHP_INT_MAX` etc)
[ ] `isset`/`unset` - [ ] `isset`/`unset`
[ ] `instanceof` - [ ] `instanceof`
[X] Ternary expressions - [X] Ternary expressions
- Implemented as inline closure - Implemented as inline closure
[X] `die` - [X] `die`
[X] `try`/`catch`/`finally` - [X] `try`/`catch`/`finally`
- [X] Implement using err checks, not panic/recover - [X] Implement using err checks, not panic/recover
- Any statements within the try block should capture the finally/catch to run within any interior err-check blocks - Any statements within the try block should capture the finally/catch to run within any interior err-check blocks
- [ ] `finally` - [ ] `finally`
- Runs before any return statement inside the try block or catch block; also runs after the try block is complete - Runs before any return statement inside the try block or catch block; also runs after the try block is complete
- Maybe `finally` would be more concisely implemented as defer inside an IIFE, but that is not idiomatic, maintainable Go code - Maybe `finally` would be more concisely implemented as defer inside an IIFE, but that is not idiomatic, maintainable Go code
[X] Abandon upon sight of highly dynamic constructs - [X] Abandon upon sight of highly dynamic constructs
- [X] `eval` - [X] `eval`
- [X] `extract` - [X] `extract`
- [ ] variable-variables - [ ] variable-variables
- [ ] Attempts to enable magic_quotes or register_globals - [ ] Attempts to enable magic_quotes or register_globals
[X] Detect assignment expressions - [X] Detect assignment expressions
- Go doesn't support assignment in rvalues, only as a statement - Go doesn't support assignment in rvalues, only as a statement
- When walking below stmt level, need to first fully walk and check for any function calls + assignments that may need hoisting (and we can probably only do that correctly if there is no short-circuiting) - When walking below stmt level, need to first fully walk and check for any function calls + assignments that may need hoisting (and we can probably only do that correctly if there is no short-circuiting)
- [X] Add subtree walk + catch error for this case - [X] Add subtree walk + catch error for this case
[X] Closures - [X] Closures
- [ ] Handle value/reference captures - [ ] Handle value/reference captures
[X] Convert top-level calls to `init()`/`main()` - [X] Convert top-level calls to `init()`/`main()`
- [X] Wrap in function - [X] Wrap in function
- [X] Determine init/main based on package name - [X] Determine init/main based on package name
[ ] Class/object transformations - [ ] Class/object transformations
- [X] Convert `new X` constructor calls to `NewX` - [X] Convert `new X` constructor calls to `NewX`
- [X] Visibility - [X] Visibility
- [X] Apply PHP visibility modifiers as Go case change - [X] Apply PHP visibility modifiers as Go case change
@ -70,17 +70,17 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv
- [ ] static:: - [ ] static::
- [ ] Traits / `use` - [ ] Traits / `use`
- [ ] Abstract methods - [ ] Abstract methods
[X] Track golang package imports - [X] Track golang package imports
[X] Variadic function parameters - [X] Variadic function parameters
[X] Preserve comments - [X] Preserve comments
### Productionize ### Productionize
[ ] Multi-file programs - [ ] Multi-file programs
- [ ] Include/Require - [ ] Include/Require
[ ] Infer whether to declare variable (`var` / `:=`) or reuse (`=`) - [ ] Infer whether to declare variable (`var` / `:=`) or reuse (`=`)
- [ ] Track current visibility scope - [ ] Track current visibility scope
[ ] Comprehensive coverage of all AST node types - [ ] Comprehensive coverage of all AST node types
- [X] Create full-coverage interface to implement - [X] Create full-coverage interface to implement
- [ ] Node - [ ] Node
- [ ] Stmt - [ ] Stmt
@ -89,17 +89,17 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv
- [X] Binary - [X] Binary
- [X] Scalar - [X] Scalar
- [X] Heredocs/nowdocs - [X] Heredocs/nowdocs
[ ] Numbered break/continue - [ ] Numbered break/continue
[ ] Type inference - [ ] Type inference
- [ ] Type declarations for literals (string, slice/map with constant initializer, etc) - [ ] Type declarations for literals (string, slice/map with constant initializer, etc)
- [ ] Convert known PHP typenames to Go equivalents - [ ] Convert known PHP typenames to Go equivalents
- [ ] Parse extra types from phpdoc blocks - [ ] Parse extra types from phpdoc blocks
[X] Hoisting pass for rvalue expressions - [X] Hoisting pass for rvalue expressions
- [X] Preincrement statements - [X] Preincrement statements
- [ ] Behaviour of function calls in rvalue cases where err cannot be checked - [ ] Behaviour of function calls in rvalue cases where err cannot be checked
- [ ] Assignment expressions - [ ] Assignment expressions
- [ ] Alternately - we can support the form `if foo := bar(); foo {` - [ ] Alternately - we can support the form `if foo := bar(); foo {`
[ ] Simple standard library transformations - [ ] Simple standard library transformations
- [X] common string/array functions - [X] common string/array functions
- [ ] More string/array functions - [ ] More string/array functions
- [ ] Top 100 from https://www.exakat.io/top-100-php-functions/ - [ ] Top 100 from https://www.exakat.io/top-100-php-functions/
@ -107,12 +107,12 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv
- This has the same value semantics for ~~string literals, but not variables~~ all cases - This has the same value semantics for ~~string literals, but not variables~~ all cases
- [ ] error_reporting(E_ALL) --> just remove it - [ ] error_reporting(E_ALL) --> just remove it
- [ ] ini_set('display_errors', 'On') --> remove it when the parameter is known - [ ] ini_set('display_errors', 'On') --> remove it when the parameter is known
[ ] Elide error return for functions that cannot throw - [ ] Elide error return for functions that cannot throw
- ?? Could be a standalone Go refactoring tool - ?? Could be a standalone Go refactoring tool
### Moonshots ### Moonshots
[ ] Extended library/environment transformations - [ ] Extended library/environment transformations
- [ ] Standard library transformations - [ ] Standard library transformations
- [X] Track golang package imports - [X] Track golang package imports
- [ ] Handle conflicts between golang stdlib packages / local variable names - [ ] Handle conflicts between golang stdlib packages / local variable names
@ -129,18 +129,17 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv
- [ ] AWS SDK - [ ] AWS SDK
- [ ] PHPUnit -> Go Test - [ ] PHPUnit -> Go Test
- [ ] Replace Composer/PSR-4 autoloading with Go imports - [ ] Replace Composer/PSR-4 autoloading with Go imports
[ ] Preserve rough line spacing - [ ] Preserve rough line spacing
[ ] Somehow detect whether map use should be order-preserving - [ ] Somehow detect whether map use should be order-preserving
[ ] Support scoped namespace (`namespace { ... }`) and multiple namespaces in file - [ ] Support scoped namespace (`namespace { ... }`) and multiple namespaces in file
[ ] Validation on imported comment formats - [ ] Validation on imported comment formats
[ ] Convert wordpress / mediawiki / symfony - [ ] Convert wordpress / mediawiki / symfony
- [ ] Option to convert with preset=cli, preset=web, webroot path - [ ] Option to convert with preset=cli, preset=web, webroot path
- [ ] Option to generate built-in web server - [ ] Option to generate built-in web server
[ ] Generate source maps - [ ] Generate source maps
- The parser does have full positional information - exporting at the stmt level would be reasonable - The parser does have full positional information - exporting at the stmt level would be reasonable
- But the gofmt pass may lose this information - But the gofmt pass may lose this information
[ ] Command-line tool option to `go run` - [ ] Command-line tool option to `go run`
## Reference ## Reference